<!DOCTYPE html> <html lang="en"> <head> <Meta charset="UTF-8"> <title>title</title> <style> table{ margin:100px auto; border-spacing: 0; BACkground-color: #cccccc; } td{ width: 100px; height: 50px; text-align: center; BACkground-color: #ff0; } </style> </head> <body> <table> <tr> <th><input type="checkBox"></th> <th>T1</th> <th>T2</th> <th>T3</th> </tr> <tr> <td><input type="checkBox"></td> <td>A1</td> <td>A2</td> <td>A3</td> </tr> <tr> <td><input type="checkBox"></td> <td>B1</td> <td>B2</td> <td>B3</td> </tr> <tr> <td><input type="checkBox"></td> <td>C1</td> <td>C2</td> <td>C3</td> </tr> </table> <script src="https://code.jquery.com/jquery-1.10.1.min.js"></script> <script> $(function () { $("th>input").click(function () { $("tr input").prop("checked",$(this).prop("checked")); }); $("td input").click( function () { var allc = $("td input").length; var checkedc = $("td input:checked").length; if(allc == checkedC){ $("th>input").prop("checked",truE); } else{ $("th>input").prop("checked",falsE); } } ); }); </script> </body> </html>
以上是大佬教程为你收集整理的jQuery实现菜单全选/不选全部内容,希望文章能够帮你解决jQuery实现菜单全选/不选所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。