Answer the question
In order to leave comments, you need to log in
Why doesn't validation work in js?
There are two blocks with a data attribute:
<div class="main__categoties-wrapper__categorie" data-number="1" onclick="dropCategorie(this.dataset.number)">
<h1 class="main__categoties-wrapper__categorie-name">Очки</h1>
<img src="img/down-arrow.svg">
</div>
<div class="main__categoties-wrapper__categorie-item" data-number="1">
<img width="100px" src="img/glasses.jpg">
<h1 class="main__categoties-wrapper__categorie-item__tittle">Очки авиаторы</h1>
<h2>Артикул: 1434</h2>
<h2>Количество: 50 шт.</h2>
</div>
function dropCategorie (dropdownCategorieNumber) {
var categorie = document.querySelector(`.main__categoties-wrapper__categorie-item[data-number="${dropdownCategorieNumber}"]`);
console.log(categorie);
if (categorie.style.display == "none"){
categorie.style.display = "flex";
} else if (categorie.style.display == "flex") {
categorie.style.display = "none";
} else {
console.log("Что то пошло не так");
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question