The removeAttr() method is an inbuilt method in jQuery which is used to remove one or more attributes from the selected elements.
Syntax:
$(selector).removeAttr(attribute)
Parameters: This function accepts single parameter attribute which is mandatory. It is used to specify one or more attributes to remove. Several attributes can be separated using space operator.
Return Value: This method returns the selected element with the removed attribute.
Below example illustrates the removeAttr() method in jQuery:
Example:
<!DOCTYPE html> <html> <head> <title>The removeAttr Method</title> <script src= </script> <!-- jQuery code to show the working of this method --> <script> $(document).ready(function() { $("button").click(function() { $("p").removeAttr("style"); }); }); </script> <style> div { width: 300px; min-height: 150px; border: 2px solid green; padding: 20px; text-align:center; } </style> </head> <body> <div> <!-- click on the any of the paragraph and see the change --> <p style="font-size:35px;font-weight:bold; color:green;">Welcome to</p> <p style="font-size:35px;font-weight:bold; color:green;">GeeksforGeeks!.</p> <button>Click Here!</button> </div> </body> </html> |
Output:

Recommended Posts:
- jQuery | jQuery.fx.interval Property with example
- jQuery | jQuery.fx.off Property
- jQuery | jQuery.support Property
- jQuery | jquery Property
- jQuery | prepend() with Examples
- jQuery | dblclick() with Examples
- jQuery | offset() with Examples
- jQuery | children() with Examples
- jQuery | Hide/Show, Toggle and Fading methods with Examples
- jQuery | focusin() with Examples
- jQuery | Animation, Slide methods with Examples
- jQuery | change() with Examples
- jQuery | filter() with Examples
- jQuery | height() and innerHeight() with Examples
- jQuery | eq() with Examples
- jQuery | empty() with Examples
- jQuery | not() method with Examples
- jQuery | first() with Examples
- jQuery | parent() & parents() with Examples
- jQuery | noConflict() with Examples
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.


