HTMLAllCollection:namedItem() 方法

HTMLAllCollection 接口的 namedItem() 方法返回集合中第一个其 idname 属性与给定的字符串名称匹配的 Element,如果没有匹配的元素,则返回 null

语法

js
namedItem(name)

参数

name

一个表示我们正在查找的元素的 idname 属性值的字符串。

返回值

HTMLAllCollection 中第一个匹配 nameElement,如果没有,则返回 null

规范

Specification
HTML
# dom-htmlallcollection-nameditem

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
namedItem

Legend

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

Full support
Full support