I want to check if my dice
display is none. If it is print console.log().
My code:
const dice = document.querySelectorAll(".dice");
for (var i = 0; i < 5; i++) {
if (dice[i].style.display == "none") { //also tried with ===
console.log("nth here " + i);}
}
Here's what I also tried
for (var i = 0; i < 5; i++) {
var isVisible = (dice[i].style.display == "none");
if (isVisible){console.log('nth here ' + i);}
}
And:
for (var i = 0; i < 5; i++) {
if (document.querySelector('.dice').style.display === 'none') {
console.log("nth here " + i);
}
}
Aucun commentaire:
Enregistrer un commentaire