//绑定了li 或者tr这类元素,元素里的子元素有checkbox这中的的话会触发该点击事件和它自身点击事件导致没有选中
$(".list").on("click",".item",function(){
let children = $(this).children()["0"];
console.log(children);
if (children.checked) {
children.checked = false;
}
else {
children.checked = true;
}
});
$("input[type='checkbox']").click(function(e){
e.stopPropagation();
});
如果是动态加载元素的话
$(".list").on("click","input[type='checkbox']",function(){
e.stopPropagation();
});