1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>全选/全不选1</title> <script src="http://libs.baidu.com/jquery/1.8.3/jquery.min.js"></script> </head> <body> <input type="checkbox" class="allcheck">全选/全不选<br> <input type="checkbox" class="subcheck"> <input type="checkbox" class="subcheck"> <input type="checkbox" class="subcheck"> <input type="checkbox" class="subcheck"> <input type="checkbox" class="subcheck">
<script> $(function(){ $(".allcheck").click(function(){ $(".subcheck").prop("checked",$(".allcheck").prop("checked")); }); }); </script> </body> </html>
|