Open In App
Related Articles

HTML DOM removeAttributeNode() Method

Improve Article
Save Article
Like Article

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 the name is the attribute node to be removed. It is the required field. 

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

Example: In this example, we will see the use of the DOM removeAttributeNode() method


<!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() {
            let d = document.getElementById("p");
            let color = d.getAttributeNode("class");
            // Removing attribute node.



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

  • Google Chrome 1 and above
  • Edge 12 and above
  • Internet Explorer 8 and above
  • Firefox 1 and above
  • Opera 12.1 and above
  • Safari 1 and above

Last Updated : 14 Jun, 2023
Like Article
Save Article
Similar Reads
Related Tutorials