getElementsByClassName is a Javascript function which takes a string argument and returns elements from the current page with a class name matching the string. It is generally used to gather DOM elements for further manipulation.
getElementsByClassName()
is a javascript function which
[r]eturns a set of elements which have all the given class names. When called on the document object, the complete document is searched, including the root node. You may also call getElementsByClassName on any element; it will return only elements which are descendants of the specified root element with the given class names. – (Mozilla Developer Network documentation)