HTMLCollection namedItem()
HTMLCollection namedItem() Method
The namedItem() method is used to return named element from HTMLCollection. For this purpose, it uses the id or name attribute to identify elements. Elements in it can be accessed by their index numbers that start at 0. Its length property will return the number of elements in HTMLCollection
Syntax:-
Its syntax is:- HTMLCollection[name] OR HTMLCollection.namedItem(name)
Return:-
Its return is:- element having specific id or name
Further Explanation:-
Parameter | Description |
name | Required. Value of id or the name attribute of element. |