HTML DOM Element setAttributeNode()
HTML DOM Element setAttributeNode() Method
The setAttributeNode() method is used to add an attribute node to an element and if that attribute is already present it will replace it. It returns Attribute object. It is same as setAttribute() but the main difference is that setAttribute() is used to replace attributes value while setAttributeNode() is used to replace Attribute objects.
Syntax:-
Its syntax is:- element.setAttributeNode(node)
Return:-
Its return is:- Attr object which represent replaced attribute node