+ 1
get element by class name NOT WORKING
actually i know that you need to access the element by arr{0].style.dislay .but i have got 8 element together to select and can't do it one by one also the code will become very long so i want to know how can I do it all together !
2 odpowiedzi
+ 4
You forgot to attach your code with the Description ☝
+ 4
Just use a for loop;
elems = document.getElementsByClassName("class_name");
for (let i = 0; i < elems.length; i++) {
elems[i].style.display = ...;
}