You can use .toggleClass()
to add/remove simultaneously, i mean switch from one class to another:
Description from the docs
Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
if this is your html:
<div class="aaa">Some text.</div>
then this script:
$('div.aaa').toggleClass('bbb');
will output like this:
<div class="aaa bbb">Some text.</div>
Or if you do this:
$('elem').toggleClass('aaa bbb');
//--------------------^^^---here this class will be added/removed