jQuery .addClass() and .removeClass() method

0 votes
360 views
added May 4, 2018 in jQuery by LC Marshal Captain (25,790 points)
//remove multiple classes
$ ('#element').removeClass('firstClass secondClass');

1 Response

0 votes
responded May 4, 2018 by LC Marshal Captain (25,790 points)
// add class to element if the body contains specific class
if($(body).hasClass('forum')) {
 $('.forum-question').addClass('forum-question-style');
}
lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...