如果我单击“ LI”时需要单击活动的LI时仅显示选中的块,而单击“ Enabled LI”时仅显示未选中的块。
需要更高效的代码
<li>Active</li>
<li>Disabled</li>
javascript:
for(var i = 0; i < liLen; i+=1){
document.getElementById("linksBlock").children[0].children[0].children[1].addEventListener("click", function(){
for(var a = 0; a < childLoop.childElementCount; a++){
if($(childLoop.children[a]).find("input").is(":checked")){
console.log("Yes");
$(childLoop.children[a]).css("display","block")
}else{
console.log("No");
$(childLoop.children[a]).css("display","none");
}
}
})
}
for(var i = 0; i < liLen; i+=1){
document.getElementById("linksBlock").children[0].children[0].children[2].addEventListener("click", function(){
for(var a = 0; a < childLoop.childElementCount; a++){
if($(childLoop.children[a]).find("input").is(":checked")){
console.log("Yes");
$(childLoop.children[a]).css("display","none")
}else{
console.log("No");
$(childLoop.children[a]).css("display","block");
}
}
})
}