var selector = document.getElementsByClassName('class-name');
var elements = document.querySelector(".class");
var elements = document.getElementsByClassName(names); // or:
var elements = rootElement.getElementsByClassName(names);
var x = document.getElementsByClassName("example");
var i;
for (i = 0; i < x.length; i++) {
x[i].style.backgroundColor = "red";
}
<!DOCTYPE html>
<html>
<body>
<div class="myclass">The value is presented inside the class</div>
<button onclick="RetriveByClassName()" id="btnClick">Click</button>
<script>
function RetriveByClassName() {
var x = document.getElementsByClassName("myclass");
alert(x[0].innerHTML);
}
</script>
</body>
</html>
const whiteBoxes = document.getElementsByClassName("box-white")
document.getElementsByClassName();