How to know how many class elements there in page using js code example Example: javascript find total number of classes document.getElementsByClassName("ClassName").length