JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css">

JavaScript

$(function() {
        $( "<div id='dialogMy'><button>close</button>test</div>" ).dialog({
        
            resizable: false,
            height:140,
            modal: true
        
        });


              $("button").click(function(){
                  
                     //why wont it close?  
                      //$('#dialogMy').close();
                      $('#dialogMy').destroy();
                  
              });

    });