jQuery UI – Close Dialog When Clicked Outside

Sorry to drag this up after so long but I used the below. Any disadvantages? See the open function…

$("#popup").dialog(
{
    height: 670,
    width: 680,
    modal: true,
    autoOpen: false,
    close: function(event, ui) { $('#wrap').show(); },
    open: function(event, ui) 
    { 
        $('.ui-widget-overlay').bind('click', function()
        { 
            $("#popup").dialog('close'); 
        }); 
    }
});

Leave a Comment