JSFiddle - React, Tailwind, and code Playground

by CodingDawg

HTML

<button id="myButton">Execute Tasks</button>
<div id='myDialog' title="New Task(s):" style='display:none'>
    <p>Enter the name of the tasks you wish to execute</p>
    <form>
        <label for="name">
            <input type="text" name="name" id="name" />
        </label>
    </form>
</div>

JavaScript

$('#myButton').click(function () {
  $("#myDialog").dialog({
        open: function () {
            $(this).off('submit').on('submit', function () {
                //Run tasks
                alert('hello');
                $(this).dialog('close');
                return false;
            });
        },
        buttons: {
            "Run tasks": function () {
                $(this).find('form').submit();
            },
                "Cancel": function () {
                $(this).dialog("close");
            }
        }
    });
});