JSFiddle - React, Tailwind, and code Playground

HTML

<button>a</button>

JavaScript

$(function () {
    var confirm1 = function(){
        alert("confirm function 1");
    }
    var confirm2 = function(){
        alert("confirm function 2");
    }

    var temp = confirm1;


    $("button").click(function() {
        var NewDialog = $('<div id="MenuDialog"> <input type="text" name="fname"/> </div>');
        NewDialog.dialog({
            modal: true,
            title: "title",
            show: 'clip',
            hide: 'clip',
            buttons: [
                {text: "Submit", click: temp}
            ]
        });
        return false;
    });

    //  Uncomment this line if you want to change temp function
   //   temp = confirm2;

});