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.


You can try to run the following code to remove all CSS classes using jQuery:

Live Demo

      <title>jQuery Selector</title>
      <script src = ""></script>
         $(document).ready(function() {
         .red { color:red; }
         .blue { color:blue; }
      <p class = "red" >This is first paragraph.</p>
      <p class = "blue">This is second paragraph.</p>
      <button id="button1">Remove</button>

Updated on: 06-Dec-2019

4K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started