Skip to content
Related Articles

Related Articles

Improve Article

HTML | DOM removeAttributeNode() Method

  • Last Updated : 26 Jul, 2019

The DOM removeAttributeNode() method is used to remove the specified attribute from the current element. It is similar to removeAttribute() method but the difference is that the removeAttribute method is used to remove the attribute with the specified name, but on the other hand removeAttributeNode removes the specified attribute object.



Where name is the attribute node to be removed. It is the required field.

Return Value: It returns the attribute node to be removed.


<!DOCTYPE html>
    <title>HTML DOM removeAttributeNode Method</title>
        .gfg {
            color: green;
<body style="text-align: center;">
    <h1 style="color:green;">
            DOM removeAttributeNode Method
    <p id="p" class="gfg">
      A computer science portal for geeks.
    <button onclick="Geeks()">Click Here!</button>
        function Geeks() {
            var d = document.getElementById("p");
            var color = d.getAttributeNode("class");
            // Removing attribute node.


Before click on the button:

After click on the button:

Supported Browsers: The browser supported by removeAttributeNode() method are listed below:

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

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

My Personal Notes arrow_drop_up
Recommended Articles
Page :