THE WORLD'S LARGEST WEB DEVELOPER SITE

The HTML DOM Attribute Object


The Attr Object

In the HTML DOM, the Attr object represents an HTML attribute.

An HTML attribute always belongs to an HTML element.


The NamedNodeMap Object

In the HTML DOM, the NamedNodeMap object represents an unordered collection of an elements attribute nodes.

Nodes in a NamedNodeMap can be accessed by name or by index (number).


Properties and Methods

Property / Method Description
attr.isId Returns true if the attribute is of type Id, otherwise it returns false
attr.name Returns the name of an attribute
attr.value Sets or returns the value of the attribute
attr.specified Returns true if the attribute has been specified, otherwise it returns false
   
nodemap.getNamedItem() Returns a specified attribute node from a NamedNodeMap
nodemap.item() Returns the attribute node at a specified index in a NamedNodeMap
nodemap.length Returns the number of attribute nodes in a NamedNodeMap
nodemap.removeNamedItem() Removes a specified attribute node
nodemap.setNamedItem() Sets the specified attribute node (by name)