JSFiddle - React, Tailwind, and code Playground

HTML

<input type="button" value=" Toggle " /><br/>
<input type="button" value=" Toggle " /><br/>
<div></div>

JavaScript

$(function() {    
    $("input").each(function() {
        var counter = 1;
        $(this).click(function() {
            counter++ % 2 ? 
                (function() { $("div").html("one"); }()) :                    // <== First function
                (function() { $("div").html("two"); }());                    // <== Second function
        });
    });
});