tags:

views:

161

answers:

1

I am trying to override close method of Jquery Dialog method.

Code :

jQuery.Dialog.close = function() {
    alert('my close');
}

But its not working. Please help.

+2  A: 

You're setting it up wrong. Check this out to see how to do it correctly.

Ok, so that link doesn't take you where I thought it would. Here's the relevant bit from jqueryui.com.

closeType:dialogclose
This event is triggered when the dialog is closed.

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) {
  ...
});
Jason
I tried it but not working as i expected. My aim is when i hit the close button i want to hide() not to close.
Soft
i don't believe you can do this without modifying the actual jquery dialog code.
Jason