CheckBox全选中与非选中状态的代码
$("body").on("click","section .target .input .menu ul li ",function(){//is(":checked"))来判断是否为选中状态,参考:http://wh.ac.cn/forum.php?mod=viewthread&tid=2374
//半选中状态,参考:http://wh.ac.cn/forum.php?mod=viewthread&tid=2991
if($(this).is(":checked")){ //方法一: 通过each来逐一处理
$(this).closest("li").find("ul li ").each(function(){
$(this).prop('checked',true);
});
}else{
//方法二:通过DOM统一处理,attr(),也是可以支持的
$(this).closest("li").find("ul li ").prop("checked",false);
}
})
页:
[1]