Reputation: 445
I am using jquery ui dialog box. My question, I want to track the okay button and close dialog which is the X button on the dialog box separately. If the dialog is closed using X button then the dialog close event should not occur.
Upvotes: 0
Views: 84
Reputation: 2271
You should use the the dialogclose event
$( ".dropDownBox" ).on( "dialogclose", function( event, ui ) {} );
you can then use the event variable inside the function for finding either it was x or ok button
Upvotes: 0
Reputation: 1189
You can just track buttons like this. That way you won't track the X button but just those that you want to.
$( ".selector" ).dialog({
buttons: [ { text: "Ok", click: function() {
//TRACK IT HERE
$( this ).dialog( "close" );
} } ]
});
Upvotes: 0
Reputation: 1803
If using jQuery you can try using the beforeClose option!
$( "#yourdialog" ).dialog({
beforeClose: function(event, ui) { ... }
});
Upvotes: 0
Reputation: 11741
Using CSS that does not over ride every dialog on the page.
The CSS
.no-close .ui-dialog-titlebar-close {display: none }
The HTML
<div class="selector" title="No close button">
Dialog box without close button
</div>
demo here
http://jsfiddle.net/AGZKF/413/
Upvotes: 1