JSFiddle - React, Tailwind, and code Playground

HTML

<a id="click-button">clickata</a>

JavaScript

$(function() {
    $('#click-button').on({
        firstClick : function()
        {
            // do something
            alert(111);
            
            // switch back
            $(this).data('nextClick', 'secondClick');
        },
        
        secondClick : function()
        {
            // do something
            alert(222);
            
            // switch back
            $(this).data('nextClick', 'firstClick');
        }
    });
});