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.
Asked
Active
Viewed 3,184 times
2 Answers
2
Is this any use?
$('div#popup_content').bind('dialogclose', function(event) {
alert('closed');
});
Taken from here.

Community
- 1
- 1

biscuitstack
- 11,591
- 1
- 26
- 41
0
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) { ... }
});

JohnP
- 49,507
- 13
- 108
- 140
-
I honestly cannot figure this out. I have a function that I use around my application to open my dialog 'function showDialog(id) { $(id).dialog("open"); } but I cannot get this to work: $(<%= this.updateStatus.ClientID %>).dialog({ close: function(event, ui) { alert("BANG!"); } }); ' Any ideas? – Tom Feb 22 '11 at 13:51
-
Never mind, looks like I have to bind the close function to my custom objects. I have created a custom control that will contain the jquery dialog box as well as a custom control for each button needed. – Tom Feb 22 '11 at 14:15
-
Have you got it figured out? If you post some sample code I could give a more definitive answer – JohnP Feb 22 '11 at 15:54