JavaScript Objects: Attr

By: Dusty Arlia
Published on Tuesday, April 1, 2014, 06:30 PM
Last Updated on Sunday, July 05, 2015 at 4:20 PM
Total Updates: 2

The Attr JavaScript object represents an attribute of an Element node. You can access an Attr object through the attribute property of the Node interface or by calling the getAttributeNode() or getAttributeNodeNS() methods of the Element interface.

Most of the time you will use the Element.getAttribute() and Element.setAttribute() methods to get and set the attribute value.