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开发者_StackOverflow社区" ).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
I've been looking for an answer to this too - so far the best I've come up with is
$( ".selector" ).dialog({
beforeClose: function(event, ui) {
//mycode
return false;
}
});
$('.selector').bind('dialogbeforeclose', function(event,ui){
alert('hello');
});
精彩评论