Reputation: 463
How can I set a callback function to be ran when a modal dialog is closing, without the click of a button or close (x) icon?
Upvotes: 1
Views: 3151
Reputation: 17910
you can also try,
$( ".selector" ).dialog({
beforeClose: function(event, ui) { ... }
});
This event is triggered when a dialog attempts to close. If the beforeClose
event handler (callback function) returns false, the close will be prevented.
Upvotes: 1
Reputation: 55200
Why dont you try the event close
of jQuery UI dialog?
Code examples
Supply a callback function to handle the close event as an init option.
$( ".selector" ).dialog({
close: function(event, ui) { ... }
});
Bind to the close event by type: dialogclose.
$( ".selector" ).bind( "dialogclose", function(event, ui) {
...
});
Upvotes: 1