HTML | DOM removeNamedItem() Method
The removeNamedItem() method in HTML is used to remove the node with the specified name in a namednode object.
Syntax:
namednode.removeNamedItem( nodename )
nodename: This method accepts single parameter nodename which is mandatory. It refers to the name of the node in the namednode which need to remove.
Example:
<!DOCTYPE html> <html> <head> <title> DOM removeNamedItem() Method </title> <script> function myFunction() { var button = document.getElementsByTagName("INPUT")[0]; button.attributes.removeNamedItem("type"); } </script> </head> <body style = "text-align: center;"> <h1 style = "color: green"> GeeksforGeeks </h1> <h2> DOM removeNamedItem() Method </h2> <input type="button" value="Change It!"> <!-- removeNamedItem() method used here --> <button onclick="myFunction()"> Click Here! </button> </body> </html> |
Output:
Before click on the Click Here Button:

After click on the Click Here Button:

Note: When we are removing the type attribute of an input element, then the element will be of type text, which is the default value.
Supported Browsers: The browser supported by removeNamedItem() method are listed below:
- Apple Safari
- Google Chrome
- Firefox
- Opera
- Internet Explorer
Recommended Posts:
- HTML | DOM contains() Method
- HTML | DOM isEqualNode() Method
- HTML | DOM compareDocumentPosition() Method
- HTML | DOM normalize() Method
- HTML | DOM removeAttributeNode() Method
- HTML | DOM querySelectorAll() Method
- HTML | DOM hasChildNodes() Method
- HTML | DOM querySelector() Method
- HTML | DOM getElementsByTagName() Method
- HTML | method Attribute
- HTML | DOM cloneNode() Method
- HTML | DOM exitFullscreen() Method
- HTML | DOM createComment() Method
- HTML | DOM isDefaultNamespace() Method
- HTML | DOM renameNode() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



