0
How do i select all in one shot?
i have this code here https://code.sololearn.com/Ww6A4zARPFzh/?ref=app is there a way to select all in one or two lines of code? Without rewriting the code and change just the number of the array?
6 Answers
+ 6
try selecting the div tags
+ 4
Use a for loop to itterate over the array of elements.
+ 3
Thanks @Kamil
+ 1
use this code inside the your "on" function
var z = document.getElementsByClassName("one");
for (var i = 0; i < z.length; i++) {
z[i].style.color="blue";
}
+ 1
Thank you all for your answers.I found them all usefull!