HTML DOM Attributes removeNamedItem() Method

Definition and Usage

removeNamedItem() The method deletes the node with the specified name in the namedNodeMap.

Example

Remove from the input button type Property:

const nodeMap = document.getElementById("myInput").attributes;
nodeMap.removeNamedItem("type");

Try it yourself

Tip:After the type attribute of the input element is deleted, the element will become a text type, that is, the default value.

Syntax

namednodemap.removeNamedItem(nodename)

Parameter

Parameter Description
nodename Required. The name of the attribute node to be deleted.

Return value

Type Description
Node The attribute node that was deleted.

Browser support

attributes.removeNamedItem() It is a feature of DOM Level 1 (1998).

All browsers support it:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support 9-11 Support Support Support Support