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').live('click',function(){

        $(this).removeClass('off').addClass('on');
        alert('ok');
 });


$('#test.on').live('click',function(){
    
        $(this).removeClass('on').addClass('off');
        alert(' pas ok');
 });