DOM - Attribute Object


Advertisements


Attr interface represents an attribute in an Element object. Typically, the allowable values for the attribute are defined in a schema associated with the document. Attr objects are not considered as part of the document tree since they are not actually child nodes of the element they describe. Thus for the child nodes parentNode, previousSibling and nextSibling the attribute value is null.

Attributes

The following table lists the attributes of the Attribute object −

Attribute Type Description
name DOMString This gives the name of the attribute.
specified boolean It is a boolean value which returns true if the attribute value exists in the document.
value DOMString Returns the value of the attribute.
ownerElement Element It gives the node to which attribute is associated or null if attribute is not in use.
isId boolean It returns whether the attribute is known to be of type ID (i.e. to contain an identifier for its owner element) or not.


Advertisements
E-Books Store