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 or name 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

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
namedItem
Chrome – Full support
Chrome 5 (Release date: 2010-05-25)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 32 (Release date: 2014-09-02)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 5 (Release date: 2010-06-07)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 32 (Release date: 2014-09-02)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 4 (Release date: 2010-06-21)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 3 (Release date: 2011-02-22)
footnote Full support
WebView on iOS – Full support
WebView on iOS 4 (Release date: 2010-06-21)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support