Tom
Tom

Reputation: 1057

Javascript function on jQuery dialog close

I have a jQuery dialog box. This box launches when a link is clicked. This link launches a function that loads the textfields within the dialog box. I have another function that is executed within the dialog load function. This looks through all of the objects and matches the table rows to the object clicked and sets a different class for that row. Now on exit i just need to do the same. How can I bind a function to the close event of that particular dialog? I just need to fire a javascript event everytime the dialog window is closed.

Upvotes: 0

Views: 3191

Answers (2)

JohnP
JohnP

Reputation: 50009

You can bind an event to the beforeClose or close event of the jquery dialog box

$( ".selector" ).dialog({
   close: function(event, ui) { ... }
});

$( ".selector" ).dialog({
   beforeClose: function(event, ui) { ... }
});

http://docs.jquery.com/UI/Dialog#event-close

Upvotes: 0

biscuitstack
biscuitstack

Reputation: 12102

Is this any use?

$('div#popup_content').bind('dialogclose', function(event) {
     alert('closed');
 });

Taken from here.

Upvotes: 2

Related Questions