Answer the question
In order to leave comments, you need to log in
How can I make sure that when clicking on each of the blocks, its own content appears?
There are several divs. Their number can be any, not fixed. It is necessary that when you click on each of the divs, its content gets out. Each has its own content. How to implement this? I understand that the analogy is with tabs, but I can’t think of it on my own.
Answer the question
In order to leave comments, you need to log in
div * {opasity: 0;}
let parentElement = document.querySelector('div').parentNode;
parentElement.addEventListener('click', function (e) {
let elemArr = e.target.children;
for(let i = 0; i < elemArr.lenght; i++) {
elemArr[i].style.opasity = '1';
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question