Thuộc tính DOM HTML
Đối tượng Attr
Trong HTML DOM, đối tượng Attr đại diện cho một thuộc tính HTML.
Thuộc tính HTML luôn thuộc về một phần tử HTML.
Đối tượng NamedNodeMap
Trong HTML DOM, đối tượng NamedNodeMap đại diện cho một tập hợp các nút thuộc tính phần tử không có thứ tự.
Các nút trong NamedNodeMap có thể được truy cập bằng tên hoặc theo chỉ mục (số).
Thuộc tính và phương thức thuộc tính
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 |
Thuộc tính và phương thức NamedNodeMap
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 |