jQuery: removeClass

Imagine we have some paragraphs with a few classes applied to them.

Let’s try to remove a class from them.

<!doctype html>
    <title>removeClass demo</title>
    <script src='//code.jquery.com/jquery-1.10.2.js'></script>
        p {
            margin: 4px;
            font-size: 16px;
            font-weight: bolder;
        .blue {
            color: blue;
        .under {
            text-decoration: underline;
        .highlight {
            background: yellow;

<p class='blue under'>Hello</p>
<p class='blue under highlight'>and</p>
<p class='blue under'>then</p>
<p class='blue under'>Goodbye</p>



Try The Code

The p:even here will select the even number of <p> elements which are line 0 and 2 since there are 4 paragraphs here.

Series Navigation<< jQuery: Common DOM manipulation methods
jQuery: Animations and Effects. >>