【前言】
jQuery实现全选与全不选
【主体】
之前文章用JS实现全选纯JS实现全选与全不选,这里介绍下如何通过jquery实现全选。
全选:<input type="checkBox" name="delAll" onchange="checkAll()"> <input type="checkBox" name="del"> <input type="checkBox" name="del"> <input type="checkBox" name="del"> <input type="checkBox" name="del"> <input type="checkBox" name="del"> <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript"> $(function(){ $("input[name=delAll]").click(function(event) { $("input[name=del").attr("checked",$(this[0].checked); }); }) </script>