JSFiddle - React, Tailwind, and code Playground

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/eggplant/jquery-ui.css">
<div id="pleasewaitdialog">Please wait...</div>
<div>Hello</div>
<button id='dialogOpen'>Click Me</button>

JavaScript

$(function () {

  $("#pleasewaitdialog").dialog({
    'modal': true,
    'autoOpen': false,
  });

  alert("test program started");

  // open the dialog
  $("#pleasewaitdialog").dialog("open");

  setTimeout(function () {
    // simulate doing something expensive;
    for (var i=0; i<500000000; i++);

    // close the dialog
    $("#pleasewaitdialog").dialog("close");

    alert("test program ended");
  },1);
});