JSFiddle - React, Tailwind, and code Playground

HTML

<div class="lorem">Lorem ipsum</div>
<div class="dialog">Well hello!</div>

JavaScript

$('.dialog').dialog({
    title: "Hello World",
    buttons: {
        "Ok": function() {
          console.log('ok');
          $('.dialog').dialog('destroy');
        },
        "Cancel": function() {
          console.log('cancel');
          $('.dialog').dialog('destroy');            
        }
    }
});

$('.dialog').parent().focusin(function() {
  append('focus in');
});

$('.dialog').parent().focusout(function() {
  append('focus out');
});

function append(text) {
  $('.lorem').append($('<p></p>').text(text));      
}