HTMLAllCollection: namedItem() method
The namedItem()
method of the HTMLAllCollection
interface returns the first Element
in the collection whose id
or name
attribute matches the specified name, or null
if no element matches.
Syntax
js
namedItem(name)
Parameters
name
-
A string representing the value of the
id
orname
attribute of the element we are looking for.
Return value
The first Element
in the HTMLAllCollection
matching the name
, or null
, if there are none.
Specifications
Specification |
---|
HTML # dom-htmlallcollection-nameditem |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
namedItem |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.