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 26 27 28 29 30 31
| <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script src="js/jquery-2.1.1.min.js"></script> <script> $(document).ready(function(){ $("#CheckAll").on("change",function(){ if($("#CheckAll").prop("checked")){ $('input[name=subBox]').prop('checked', true); }else{ $('input[name=subBox]').prop('checked', false); } });
$(".chec") }); </script> </head> <body> <div class="check"> <input id="CheckAll" type="checkbox" />全选 <input name="subBox" type="checkbox" /> <input name="subBox" type="checkbox" /> <input name="subBox" type="checkbox" /> <input name="subBox" type="checkbox" /> </div> <input id="btn" type="button" value="按钮" /> </body> </html>
|