views:

41

answers:

1

i'm using JQuery-ui dialog;

i'd like to perform my custom actions when user clicks on dialog's close button [X], but i'd like to prevent the closing event too!

i tried this code without success:

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

Even if i wrote the code above the dialog is closed bypassing my "preventDefault".

Thank you!

MV

A: 

$('.selector').bind('dialogbeforeclose', function(event,ui){
  alert('hello');
});
jtp