Javascript Reference
Categories: attributes

javascript attributes setNamedItemNS( )

@March 15, 2008, 1:22 a.m.
setNamedItemNS( )Firefox/Netscape/NN 6 IE n/a Chrome/Safari/DOM 2  



Inserts a single Attr object into the current collection of attributes. If the destination of the attribute is an existing element, you may also use the setAttributeNodeNS( ) method on the element to insert the Attr object. When the setNamedItemNS( ) method is invoked, the browser first looks for a match between the new attribute's pairing of local name and namespace URI and existing attribute local names and namespace URIs within the collection. If there is a match, the new attribute replaces the original one; otherwise, the new attribute is added to the collection.


A reference to an Attr node object created through document.createAttribute( ) or an Attr node from another element in the document tree.

Returned Value

Reference to an Attr object either created anew or referenced from elsewhere in the document tree.

Powered by Linode.