HTML DOM Document getElementsByClassName()
HTML DOM Document getElementsByClassName() Method
The getElementsByClassName() method is used to return collection of elements with a specific class. It is read-only property and returns HTMLCollection. Elements in collection can be accessed by index which starts at 0. For multiple classes, just separate them with space.
Syntax:-
Its syntax is:- document.getElementsByClassName(classname)
Return:-
Its return is:- collection of elements with specific class
Further Explanation:-
Parameter | Description |
classname | Required. The class name of the elements. |