1var elements = document.getElementsByClassName(names); // or:
2var elements = rootElement.getElementsByClassName(names);
1var x = document.getElementsByClassName("example");
2var i;
3for (i = 0; i < x.length; i++) {
4 x[i].style.backgroundColor = "red";
5}