HTML DOM Attributes removeNamedItem()
Example
Remove the type attribute from an input button:
const nodeMap = document.getElementById("myInput").attributes;
nodeMap.removeNamedItem("type");
Try it Yourself »
Note: When removing the type attribute of an input element, the element will be of type text, which is the default value.
Definition and Usage
The removeNamedItem()
method removes a node (by name) in a NamedNodeMap.
Syntax
namednodemap.removeNamedItem(nodename)
Parameters
Parameter | Description |
nodename | Required. The name of the attribute node to remove |
Return Value
Type | Description |
A node | The removed attribute node. |
Browser Support
attributes.removeNamedItem()
is a DOM Level 1 (1998) feature.
It is fully supported in all browsers:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | 9-11 | Yes | Yes | Yes | Yes |