How can I on click add and remove a class with jQuery? I need .other-class to be unaffected.
So when you click .other-class.one it becomes .other-class.two. If you click on .other-class.two it becomes .other-class.one.
This is what I have so far however the 2nd load of JS doenst work.
<p class="other-class one">Trigger</p>
.one {
background: red;
}
.two {
background: blue;
}
.other-class {
text-decoration: underline;
}
$('.one').click(function(){
$(this).removeClass('one');
$(this).addClass('two');
});
$('.two').click(function(){
$(this).removeClass('two');
$(this).addClass('one');
});