AvailabilityDOM Level 1 Core SynopsisAttr setAttributeNode(Attr newAttr) throws DOMException; Arguments
ReturnsThe Attr node that was replaced by newAttr, or null if no attribute was replaced. ThrowsThis method may throw a DOMException with a code of the following values:
DescriptionThis method adds a new Attr node to the set of attributes of an Element node. If an attribute with the same name already exists for the Element, newAttr replaces that attribute, and the replaced Attr node is returned. If no such attribute already exists, this method defines a new attribute for the Element. It is usually easier to use setAttribute( ) instead of setAttributeNode( ). However, you should use setAttributeNode( ) when you need to define an attribute whose value contains an entity reference for an XML document. See Also |