-2
The code below works for a specific ID, I needed a code that affects several elements and not just a specific id.
function myFunction() {
var x = document.getElementById("myDIV");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
<button onclick="myFunction()">Click Me</button>
<div id="myDIV">
This is my DIV element.
</div>
Please click [Edit] and put an example of HTML and what elements you want to modify at once. It has several ways to do, but it will depend on the structure of the page and what elements you want to take
– hkotsubo
Important you [Dit] your question and explain objectively and punctually the difficulty found, accompanied by a [mcve] of the problem and attempt to solve. To better enjoy the site, understand and avoid closures and negativities worth reading the Stack Overflow Survival Guide in English.
– Bacco