get element by class

JavaScript
var elementsArray = document.getElementsByClassName("someclassname"); var x =
 document.getElementsByClassName("example");

  var x = document.getElementsByClassName("example");

 var myElement=document.getElementById("someElementID");var elements = document.getElementsByClassName(names); // or:
var elements = rootElement.getElementsByClassName(names);
Source

Also in JavaScript: