jQuery 实现全选(全不选)


控制全选和全不选的checkBox代码如下:

<input type="checkbox" name="checkAll" id="checkAll" Onclick="JavaScipt:doCheckAll()">  

doCheckAll() 函数如下:
  1. function doCheckAll() {   
  2.     if ($('#checkAll').attr('checked')) {   
  3.         $("input[name='productId']").attr('checked',true);   
  4.     } else {   
  5.         $("input[name='productId']").attr('checked',false);   
  6.     }                  
  7. }  

其中,请你修改$("input[name='productId']")成你自己的代码。

 

 

 

 

 

 

相关内容