Skip to content

I was searching for a way to close my modal dialog box when clicked outside of the dialog and i found a very good article by Ryan Jeffords at: http://www.ryanjeffords.com/blog/entry/closing-a-jquery-ui-dialog-when-the-dialog-loses-focus

Thanx Ryan

<script type="text/javascript">
   //Wait for the document to load
   $(document).ready(function() {
      //Create the dialog and open it
      $("#dialog").dialog();
      //Bind to the ui-widget-overlay and watch for when it is clicked
      $('.ui-widget-overlay').live("click", function() {
         //Close the dialog
         $("#dialog").dialog("close");
      });
   });
</script>