Javascript Reference
Categories: Element

javascript Element setAttributeNode( )

@May 11, 2009, 10:25 a.m.
setAttributeNode( ) Firefox/Netscape/NN 6 IE 6 Chrome/Safari/DOM 1  

setAttributeNode(attrObjectReference)

  

Inserts or replaces an attribute in the current element. The parameter is a reference to an Attr node object that is either created anew or references from another element in the document tree. When the setAttributeNode( ) method is invoked, the browser first looks for a match between the new attribute's name and existing attribute names. If there is a match, the new attribute replaces the original one; otherwise, the new attribute is added to the attributes of the element. Adding an attribute node does not change the source code when viewed through the browser, but may affect how the browser renders the element if the attribute affects the visual representation of the element. The value of the new attribute may be retrieved via the getAttribute( ) method.

 
Parameters
 
 
Returned Value

Reference to a replaced Attr object (which is no longer part of the document tree) or null for an insertion.

Under moderation.
ascendeyoiaa - 2016-05-26

Powered by Linode.