title: Jquery UI Dialog - Custom Close Button (X)
body: <p>I would like to set some custom functions for when I click the standard X button. I have scrolled through the API and all related information and it is completely barren when it comes to this. The documentation is shockingly poor and rather sub standard for such a commonly used piece of software.</p>
  
  <p>What I want to do is when the X is clicked I would like it to run some custom code. Unfortunetely the X button lacks an id and there is no documentation on how to access it directly. I have seen answers on here suggesting users to create a "Close" button but that seems rather pointless as it already comes with one and further more I don't wish to have a close button located at the bottom of the window but in the title bar.</p>