Several “buttons” have been selected via “querySelectorAll”, their class is the same, and by clicking on one of them I want to add a “style” to the class named “basket”. But because I’ve never done this before, I can’t do it, I don’t know how to do it, and this is the code I wrote.
let basket = document.querySelectorAll(".basket")
document.querySelectorAll('.pBasket').forEach(item => {
item.addEventListener('click', event => {
basket.style.display = "block"
})
})
.basket {
width: 100%;
height: 100%;
position: fixed;
z-index: 10;
background-color: rgba(0, 0, 0, 0.8);
top: 0;
left: 0;
display: none;
}
<div class="smra smallRaditation">
<h5>130 000 so`m</h5>
<hr>
<div class="colBox">
<h3>Ventilatsiya</h3>
<div class="rowBox">
<button class="pBtn pBasket">Savatga</button>
</div>
</div>
</div>
<div class="basket">
</div>
let basket = document.querySelectorAll(".basket")
document.querySelectorAll('.pBasket').forEach(item => {
item.addEventListener('click', event => {
basket.style.display = "block"
})
})