title: jQuery Dialog, closing when click outside
body: <p>I know I can use the following to close the dialog box by clicking outside:</p>
  
  <pre><code>$('.ui-widget-overlay').click(function() { $("#dialog").dialog("close"); });
  </code></pre>
  
  <p>But how do I change this so it works for every dialog box, ie I want to say close any dialog box as we have multiple on a page and would be easier to have one line of code?</p>