Consider following code:

        $elem = $(".cRed");
    <div class="cRed cBlue">Something</div>

        $elem = $(".cRed");
        $elem.toggleClass("cBlue cBrown");
        $elem.toggleClass("cRed  cBrown");

What classes will be added to <div> element after the page fully loaded?
 $elem = $(".cRed");
    $elem.addClass("cBrown").removeClass(".cRed"); // will do nothing, because there is no div element at that moment.
    $elem.toggleClass("cBlue cBrown"); // add class "cBlue cBrown"
    $elem.toggleClass("cRed  cBrown"); // remove (toggle) class

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes