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.
Description
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 | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | 9-11 |