how to get element by class name javascript

JavaScript
var elementsArray = document.getElementsByClassName("someclassname");//get array of class names in Javascript
var classesArray = document.getElementById('myElementID').className.split(/\s+/);document.getElementsByClassName("legend").style.display="none";
Source

Also in JavaScript: