Skip to content
Related Articles

Related Articles

HTML | DOM removeAttribute() Method

View Discussion
Improve Article
Save Article
  • Last Updated : 11 Jul, 2022

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



Where name is the string which specifies the name of the attribute to remove from the element. It is the required field. 



<!DOCTYPE html>
      HTML DOM removeAttribute Method
        .gfg {
            color: green;
<body style="text-align: center;">
    <h1 style="color:green;">
       DOM removeAttribute Method
    <p id="p" class="gfg">
       A computer science portal for geeks.
    <button onclick="Geeks()">
        Click Here!
        function Geeks() {
            //Remove class attributes from 'p' element.


Before click on the button: 


After click on the button:


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

  • Google Chrome 1
  • Edge 12
  • Internet Explorer 5
  • Firefox 1
  • Opera 8
  • Safari 1

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!