Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML | DOM removeNamedItem() Method

  • Last Updated : 13 Aug, 2021

The removeNamedItem() method in HTML is used to remove the node with the specified name in a namednode object.

namednode.removeNamedItem( nodename )

Parameter: The removeNamedItem() contain only one parameter nodename that is described below. 

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

  • 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.

Return Value: It returns a Node object that, representing the removed attribute node




<!DOCTYPE html>
            DOM removeNamedItem() Method
            function myFunction() {
                var button =
    <body style = "text-align: center;">
        <h1 style = "color: green">
            DOM removeNamedItem() Method
        <input type="button" value="Change It!">
        <!-- removeNamedItem() method used here -->
        <button onclick="myFunction()">
            Click Here!

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: 

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


My Personal Notes arrow_drop_up
Recommended Articles
Page :