1 $("#selectAll").click(function(){ 2 $("input[name=‘checkbox‘]").each(function(){ 3 if($(this).attr("checked")){ 4 $(this).removeAttr("checked"); 5 }else{ 6 $(this).attr("checked","true"); 7 } 8 }) 9 });
原文:http://www.cnblogs.com/shichaowen/p/7988054.html