HTML DOM Document getElementsByTagName()
HTML DOM Document getElementsByTagName() Method
The getElementsByTagName() method is used to return collection of all elements with a specific tag name. It returns is HTMLCollection and is read-only property. Elements in a collection can be accessed by an index that starts at 0.
If we want to select every tag then we have to write:- getElementsByTagName("*")
Syntax:-
Its syntax is:- document.getElementsByTagName(tagname)
Return:-
Its return is:- collection of element with specific tag name
Further Explanation:-
Parameter | Description |
tagname | Required. The tag name of the elements. |