views:

1684

answers:

2

hi,

is there a default option to close a jquery dialog by clicking somewhere on the screen instead of the close icon?

thx, fux

+1  A: 

When creating a JQuery Dialog window, JQuery inserts adds a ui-widget-overlay class. If you bind a click function to that class to close the dialog, it should provide the functionality you are looking for.

Code will be something like this (untested):

$('.ui-widget-overlay').click(function() { $("#dialog").dialog("close"); });
Jon