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.
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.
js
namedItem(name)
nameA string representing the value of the id or name attribute of the element we are looking for.
The first Element in the HTMLAllCollection matching the name, or null, if there are none.
| Specification | 
|---|
| HTML Standard  # dom-htmlallcollection-nameditem  | 
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
namedItem | 
5 | 12 | 32 | 11 | 15 | 5 | 3 | 18 | 32 | 14 | 4 | 1.0 | 
    © 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLAllCollection/namedItem