用Jquery实现复选框的全选
2016-10-13 08:22
176 查看
<html> <head> <title>用Jquery实现复选框的全选</title> <script src="../javascript/jquery-1.4.2.min.js"></script> <script type="text/javascript"> $(function () { $(function() { $("#checkAll").click(function() { $('input[name="subBox"]').attr("checked",this.checked); }); var $subBox = $("input[name='subBox']"); $subBox.click(function(){ $("#checkAll").attr("checked",$subBox.length == $("input[name='subBox']:checked").length ? true : false); }); }); }) </script> </head> <body> <div> <input id="checkAll" type="checkbox">全选 <input name="subBox" type="checkbox" />项1 <input name="subBox" type="checkbox" />项2 <input name="subBox" type="checkbox" />项3 <input name="subBox" type="checkbox" />项4 </div> </body> </html>
相关文章推荐
- jquery实现复选框checkbox全选,取消全选
- jQuery实现点击复选框即高亮显示选中行 全选、反选
- Jquery CheckBox复选框 全选/取消全选 最佳实现方式 参考案例
- jQuery实现checkbox(复选框)选中、全选反选代码
- jquery实现复选框checkbox全选,取消全选
- jquery实现复选框checkbox全选(完善)
- jQuery判断checkbox(复选框)是否被选中以及全选、反选实现代码
- jQuery实现复选框的全选和反选:
- 用jquery实现复选框checkbox的全选
- jquery实现复选框的全选与全不选功能 .
- jQuery实现点击复选框即高亮显示选中行 全选、反选
- 选中实现jquery实现复选框checkbox全选(完善)
- jquery怎么实现全选复选框
- jquery实现复选框的全选和反选
- Jquery实现的复选框全选与取消全选
- jQuery实现复选框的全选 反选 全不选
- jQuery实现复选框全选/全部取消/反选/获得选择的值
- JavaScript 复选框全选效果&JQuery 实现简单的tab切换效果
- jquery实现复选框checkbox全选(完善)