The getNamedItem() method returns the node with the specific name (from a namedNodeMap).
The getNamedItem() method is supported in all major browsers.
Note: Internet Explorer 8 and earlier does not support this method.
Parameter | Type | Description |
---|---|---|
nodeName | String | Required. The name of the node to return |
Type | Description |
---|---|
Node object | The node with the specified name, , or null if it does not identify any node in the map |
DOM Version | Core Level 1 |
---|
The following code fragment loads "books.xml" into xmlDoc using loadXMLDoc(), loops through the <book> elements and prints the values of the category attributes:
The output of the code above will be:
getNamedItem() - Change an attribute's value