点击当前下checks下面的子class为none显示出来,则其他checks,class为none的隐藏,不直接用父隐藏显示的原因,父一直有显示的样式
<div class="checks">
<div class="none"></div>
<div class="none"></div>
<div class="none"></div>
</div>
<div class="checks">
<div class="none"></div>
<div class="none"></div>
</div>
var g = document.getElementsByClassName('checks');
for(let i = 0;i<g.length;i++) {
let none = g[i].getElementsByClassName('none');
g[i].onclick = function (e) {
for (let j =0;j<none.length;j++) {
// if() {
none[j].style.display = 'block'
// } else {
// none[j].className= 'none'
// }
}
e.stopPropagation();
}
}
杨__羊羊
相关分类