jQuery 实现全选(全不选)
jQuery 实现全选(全不选)
控制全选和全不选的checkBox代码如下:
<input type="checkbox" name="checkAll" id="checkAll" Onclick="JavaScipt:doCheckAll()">
doCheckAll() 函数如下:- function doCheckAll() {
- if ($('#checkAll').attr('checked')) {
- $("input[name='productId']").attr('checked',true);
- } else {
- $("input[name='productId']").attr('checked',false);
- }
- }
其中,请你修改$("input[name='productId']")成你自己的代码。
评论暂时关闭