Is there not a simple way to grab all of the elements with a class, instead of doing a for loop?
So instead of doing:
box = document.querySelectorAll(".box");
for(var i = 0; i < box.length; i++){
box[i]style.display = "none";
}
We can do:
/* Imagine a symbol for all is ¬ for example */
box = document.querySelectorAll(".box");
box[¬]style.display = "none";
Maybe there is a more simple way to do this already that I do not know about?
Edit: Sorry just to mention, the display: none is more so just an example
when you use document.querySelectorAll it returns nodelist so there is only one way of array to apply your changes for each element.