JSFiddle - React, Tailwind, and code Playground

by Rohan Kumar

HTML

<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.css">
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js"></script>
<div id="popup_div">
    Test the dialog
    <br/>
    <button id="btnClose">Close</button>
</div>
<button id="btn_click">Open dialog</button>

JavaScript

$(function () {
    $("#popup_div").dialog({ autoOpen: false });
    $("#btn_click").click(function () {
        $("#popup_div").dialog("open");
    });
    // code to close the dialog, let btnClose is the Id of button in popup_div
    $("#popup_div").on('click', '#btnClose', function () {
        $("#popup_div").dialog("close");
    });
});