Reputation: 23901
I want to have a jquery modal dialog that will have one button that will say "yes" and close the dialog. Is there any way to hide/turn off the default "Close" button or should I use another jquery element like a pop up panel? This code adds the yes button but does not turn off the close button:
$(document).ready(function(){
$("#dialog-message").dialog({
modal:true,
buttons: {
"Yes": function() {
$( this ).dialog( "close" );
},
}
});
});
Upvotes: 2
Views: 628
Reputation: 15356
You can hide it using CSS:
.ui-dialog-titlebar-close { display: none;}
or you can init the dialog like this:
$("#dialog-message").dialog({
modal:true,
buttons: {
"Yes": function() {
$( this ).dialog( "close" );
}
}
}).dialog("widget").find(".ui-dialog-titlebar-close").hide(); // find and hide the button right after creating the modal
Also, IE doesn't like the comma after the last property of an object so remove it.
Upvotes: 3
Reputation: 6344
CSS
.ui-dialog-titlebar-close { display: none;}
jQuery:
$(".ui-dialog-titlebar-close").remove();
Just whatever you have to do to grab the item with the class "ui-dialog-titlebar-close"
Upvotes: 1