var elements = document.getElementsByClassName(names); // or: var elements = rootElement.getElementsByClassName(names);