Skip to content
Related Articles

Related Articles

Improve Article

How to remove all CSS classes using jQuery ?

  • Last Updated : 31 Dec, 2020
Geek Week

In this article, we will remove all CSS classes for an element using jQuery. To remove all CSS classes of an element, we use removeClass() method.

The removeClass() method is used to remove one or more class names from the selected element.


$(selector).removeClass(class_name, function(index, class_name))

Parameters: This function accepts two parameters as mentioned above and described below:

  • class_name: It is optional parameter which is used to specify the class name (one or more class) to remove. Multiple class name separated with space.
  • function: It is optional parameter and it returns one or more class name which need to be removed.
    1. index: This parameter is used to return index of element.
    2. current_class_name: This parameter returns the class name of selected elements.



<!DOCTYPE html>
<html lang="en">
        How to remove all CSS classes using jQuery?
        .GFG1 {
            color: green;
        .GFG2 {
            font-size: 30px;
            font-weight: bold;
    <!-- Import jQuery cdn library -->
    <script src=
        $(document).ready(function () {
            $("button").click(function () {
<body style="text-align: center;">
    <h1 style="color: green;">
        How to remove all CSS classes using jQuery?
    <p class="GFG1 GFG2">
        Computer Science Portal
    <button>Click Here!</button>


Before button Click:

After Button Click:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :