setNamedItem
setNamedItem is a method defined by the DOM NamedNodeMap interface. It is used to add or replace an attribute node in a map that holds a collection of nodes, such as the attributes of an element. The method takes a single argument, a Node (typically an Attr).
If an item with the same name already exists in the map, setNamedItem replaces that node and
Error handling in typical DOM implementations includes several exceptions. If the NamedNodeMap is read-only, setNamedItem throws
In practice, setNamedItem is commonly used when manipulating element attributes programmatically. It is part of a
See also: getNamedItem, removeNamedItem, setNamedItemNS, getNamedItemNS, NamedNodeMap.