JSFiddle - React, Tailwind, and code Playground
HTML
<p class="other-class one">Trigger</p>
CSS
.one {
background: red;
}
.two {
background: blue;
}
.other-class {
text-decoration: underline;
}
JavaScript
$('.other-class').click(function () {
if ($(this).hasClass('one'))
$(this).removeClass('one').addClass('two');
else
$(this).removeClass('two').addClass('one');
});