HTMLAllCollection:namedItem() 方法
HTMLAllCollection
接口的 namedItem()
方法返回集合中第一个其 id
或 name
属性与给定的字符串名称匹配的 Element
,如果没有匹配的元素,则返回 null
。
语法
js
namedItem(name)
参数
name
-
一个表示我们正在查找的元素的
id
或name
属性值的字符串。
返回值
HTMLAllCollection
中第一个匹配 name
的 Element
,如果没有,则返回 null
。
规范
Specification |
---|
HTML # dom-htmlallcollection-nameditem |
浏览器兼容性
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.