JSFiddle - React, Tailwind, and code Playground
HTML
<a href="#" id="test" class="off">geo</a>
CSS
#test.off{
color:red;
}
#test.on{
color:green;
}
JavaScript
$('#test.off').click(function(){
$(this).removeClass('off').addClass('on');
alert('ok');
});
$('#test.on').click(function(){
$(this).removeClass('off').addClass('on');
alert(' pas ok');
});