0
What is wrong with this code?
2 Answers
+ 1
getElementsByClassName() returns an array of all elements with the passed class name. In order to apply style to those elements, you have to access them individually.
const blocks = document.getElementsByClassName("block");
for (let i = 0; i < blocks.length; i++) {
blocks[i].style = ...
}
0
thanks, Russ!