I want to change the background color of a class named "Zones" to blue and i've tried:
document.getElementsByClassName("Zones").style.backgroundColor = "blue";
But it's for some reason not working...
I want to change the background color of a class named "Zones" to blue and i've tried:
document.getElementsByClassName("Zones").style.backgroundColor = "blue";
But it's for some reason not working...
If there is only one class, you can do this:
document.getElementsByClassName("Zones")[0].style.backgroundColor = "blue";
If there is more than 1 class, you can do this:
var zonesLength = document.getElementsByClassName.length;
for(i = 0; zonesLength < i; i++) {
document.getElementsByClassName("Zones")[i].style.backgroundColor = "blue";
}