In the HTML DOM, an Attr object represents an HTML attribute.
An HTML attribute always belongs to an HTML element.
A NamedNodeMap is an array-like unordered collection of an element's attributes.
In other words: a NamedNodeMap is a list of Attr objects.
A NamedNodeMap has a length property that returns the number of nodes.
The nodes can be accessed by name or index numbers. The index starts at 0.
Property | Description |
---|---|
isId | Deprecated |
name | Returns an attribute's name |
value | Sets or returns an attribute's value |
specified | Returns true if the attribute is specified |
Method | Description |
---|---|
getNamedItem() | Returns an attribute node (by name) from a NamedNodeMap |
item() | Returns an attribute node (by index) from a NamedNodeMap |
length | Returns the number of attributes in a NamedNodeMap |
removeNamedItem() | Removes an attribute (node) |
setNamedItem() | Sets an attribute (node) by name |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!