$("input[name='checkbox']").each(function() {
$(this).attr("checked", true);
$(this).attr("checked", true);
});
在实现全选时使用attr改变checked的值,在第一次使用时可以全选
在取消掉一个后再使用全选就怎么也选不中
最后百度一下白attr改成prop
具有 true 和 false 两个属性的属性,如 checked, selected 或者 disabled
使用prop(),其他的使用 attr(),具体见下表: