- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to remove an attribute from each tag using jQuery?
To remove an attribute from each tag using jQuery, use the removeAttr() method. You can try to run the following code to learn how to remove attribute −
Example
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("h1").removeAttr("style"); }); }); </script> </head> <body> <h1 style="color:blue">This is heading</h1> <p>This is demo text.</p> <h1 style="color:red">This is heading</h1> <p>This is demo text.</p> <button>Remove</button> <p>Click above to remove style attribute from all h1 elements.</p> </body> </html>
- Related Articles
- How to remove disabled attribute using jQuery?
- How to remove an element from DOM using jQuery?
- How to add and remove a class to an anchor tag with jQuery?
- How to change the value of an attribute using jQuery?
- How to set new value for an attribute using jQuery?
- How to remove underline from text hyperlink using jQuery?
- How to get objects by ID, Class, Tag, and Attribute in jQuery?
- How to find an element using the attribute “HTML tag name” in Selenium?
- How can I select an element by tag name using jQuery?
- How to remove all child nodes from a parent using jQuery?
- How to get an attribute value in jQuery?
- How to add readonly attribute to an input tag in JavaScript?
- How to remove event handlers using jQuery?
- How to add a title in anchor tag using jQuery?
- How to replace innerHTML of a div tag using jQuery?

Advertisements