呵呵,jquery checkbox全选反选,我觉得有点好笑,用js几行代码搞定了,因为初学jquery,所以、、、本来以为可以:$(":checkbox").attr("checked")=true;原来不能给函数的返回值赋值!!!
以后还是得多看api,做个记录:
$(document).ready(function(){
$("#ckAll").click(function(){
if($("#ckAll").attr("checked")==true){
$(":checkbox").each(function(){
$(this).attr("checked",true);
});
}
else{
$(":checkbox").each(function(){
$(this).attr("checked",false);
});
}
});
});