- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 all CSS classes using jQuery?
To remove all classes, use the removeClass() method with no parameters. This will remove all of the item's classes.
Example
You can try to run the following code to remove all CSS classes using jQuery:
<html> <head> <title>jQuery Selector</title> <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function() { $("#button1").click(function(){ $("p").removeClass(); }); }); </script> <style> .red { color:red; } .blue { color:blue; } </style> </head> <body> <p class = "red" >This is first paragraph.</p> <p class = "blue">This is second paragraph.</p> <button id="button1">Remove</button> </body> </html>
- Related Articles
- How to remove all style attributes using jQuery?
- Pseudo-classes and all CSS Classes
- How to remove all child nodes from a parent using jQuery?
- How to remove all child nodes from a parent node using jQuery?
- How to remove all the attributes of an HTML element using jQuery?
- How to remove all the elements from DOM using element ID in jQuery?
- How to remove event handlers using jQuery?
- How to remove disabled attribute using jQuery?
- How to change CSS using jQuery?
- How can I remove all elements except the first one using jQuery?
- How to apply CSS properties using jQuery?
- How to remove all child nodes from a parent in jQuery?
- How to remove underline from text hyperlink using jQuery?
- How to remove an element from DOM using jQuery?

Advertisements