if(clickEl.parentNode.querySelector('input').checked === true) {
console.log(555);
} else {
console.log(111);
}
<li class="dropdown-category-list__list" data-filter="sneakers">
<input type="checkbox" id="filterSneakers">
<label for="filterSneakers">Sneakers</label>
</li>
When I click on input everything works fine, result = 555,111,555,111 and so on But when I click label result 111,555,555,111,111,555,555,111 and it is wrong behaviour
I know that I can wrap input into label but how to fix it withour editing html structure
Aucun commentaire:
Enregistrer un commentaire