HTML DOM removeNamedItem() Method
Example
Remove the type attribute from an input button:
var btn = document.getElementsByTagName("INPUT")[0];
btn.attributes.removeNamedItem("type");
Before removing the attribute:
After removing the attribute:
Try it Yourself »
Definition and Usage
The removeNamedItem() method removes the node with the specified name in a NamedNodeMap object.
Browser Support
Method | |||||
---|---|---|---|---|---|
removeNamedItem() | Yes | Yes | Yes | Yes | Yes |
Note: In Internet Explorer 8 and earlier, when using the removedNamedItem() method to remove an attribute, the method returns the attribute as it should, but it does not remove the attribute.
Syntax
namednodemap.removeNamedItem(nodename)
Parameter Values
Parameter | Type | Description |
---|---|---|
nodename | String | Required. The name of the node in the namedNodeMap you want to remove |
Technical Details
Return Value: | A Node object, representing the removed attribute node |
---|---|
DOM Version | Core Level 1 |