title: Why won't my jQueryUI dialog close?
body: <p>Why won't my button close the dialog?</p>
  
  <p>Here is the code and the fiddle <a href="http://jsfiddle.net/ThxjS/" rel="nofollow">http://jsfiddle.net/ThxjS/</a></p>
  
  <pre><code>$(function() {
      $( "&lt;div id='dialogMy'&gt;&lt;button&gt;close&lt;/button&gt;test&lt;/div&gt;" ).dialog({
  
          resizable: false,
          height:140,
          modal: true
  
      });
  
  
            $("button").click(function(){
  
                   //why wont it close? 
                    //$('#dialogMy').close();
                    $('#dialogMy').destroy();
  
            });
  
  });
  </code></pre>