- 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 all CSS classes using jQuery?
To remove all CSS classes using jQuery, use the removeClass() method, with no argument.
Example
You can try to run the following code to remove class:
<html> <head> <title>jQuery Example</title> <script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script> $(document).ready(function() { $("p").removeClass(); }); </script> <style> .red { color:red; } .green { color:green; } </style> </head> <body> <p class = "red" >This is first paragraph.</p> <p class = "green">This is second paragraph.</p> </body> </html>
Advertisements