zhangjianzhen
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
    </head>
    <body>
        <input type="checkbox" id="checkall" />全选<br />  
        <input type="checkbox" name="check" /><br />  
        <input type="checkbox" name="check"/><br />  
        <input type="checkbox" name="check"/><br />  
        <input type="checkbox" name="check"/><br />
        <script>
            $("#checkall").on(\'click\',function() {  
                $("input[name=\'check\']").prop("checked", this.checked);  
            });  
            $("input[name=\'check\']").on(\'click\',function() {  
                  var $subs = $("input[name=\'check\']");  
                  $("#checkall").prop("checked" , $subs.length == $subs.filter(":checked").length ? true :false);  
            }); 
        </script>
    </body>
</html>

 

分类:

技术点:

相关文章:

  • 2021-12-20
  • 2021-11-01
  • 2021-11-01
  • 2022-12-23
  • 2021-09-09
  • 2022-12-23
  • 2021-05-27
猜你喜欢
  • 2021-12-15
  • 2021-12-05
  • 2021-11-28
  • 2021-12-05
  • 2021-09-09
相关资源
相似解决方案