jquery 操作checkBox 、radio 一次取消选中后不能再选中
jquery 操作checkBox 、radio 如下代码:
$("input[type='checkbox']").each(function(){
$(this).attr("checked",true);
});
$("input[type='checkbox']").each(function(){
$(this).attr("checked","checked");
});
再一次取消选中后不能再选中:
使用以下代码可以解决(.prop()),例如:
$("input[type='checkbox']").each(function(){
$(this).prop("checked","checked");
});
//或者
$(selector).prop("checked","checked");