[jQuery] checkbox全選跟全部取消

  • 4191
  • 0
  • 2010-04-01

摘要: [jQuery] checkbox全選跟全部取消

http://blog.wu-boy.com/2008/12/23/658/

http://calos-tw.blogspot.com/2008/06/jquery-checkbox.html
 

$("#clickAll").click(function()  {

   if($("#clickAll").attr("checked"))
   {
     $("input[name='user_active_col[]']").each(function() {
         $(this).attr("checked", true);
     });
   }
   else
   {
     $("input[name='user_active_col[]']").each(function() {
         $(this).attr("checked", false);
     });          
   }
});