view raw
Brownie Brownie - 5 months ago 65
jQuery Question

Hook into dialog close event

I am using the dialog from jquery-ui.

I am looking for way to refresh the page when in some circumstances when the dialog is closed.

Is there a way to capture a close event from the dialog?

I know I can run code when the close button is clicked but that doesn't cover the user closing with escape or the x in the top right corner.


I have found it!

You can catch the close event using the following code:

 $('div#popup_content').on('dialogclose', function(event) {

Obviously I can replace the alert with whatever I need to do.
Edit: As of Jquery 1.7, the bind() has become on()