Remove close button on jQueryUI Dialog? – Stack Overflow.
Basically use this:
$("#div2").dialog({
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
There’s also a comment about hiding the button for this dialog only:
$(".ui-dialog-titlebar-close", ui).hide(); to hide the button for this dialog only. – Anton Feb 8 at 11:42
There is even a simpler way that is re-usable.
.no-close .ui-dialog-titlebar-close {display: none }
$( “.selector” ).dialog({ dialogClass: ‘no-close’ });
Thank you, David. Hooray for chaining CSS! That is much more useful. Please disregard the closeOnEscape part as that’s part of a different issue altogether.
Found an even easier method that requires no CSS.
When you open the dialog do something like this:
// start code
$(selector).dialog(“open”).dialog(“widget”).children(“div.ui-dialog-titlebar”).hide();
// end code
For dialogs that automatically open when you construct/initialize them you’ll need to tweak the selector but for the most part that’s the general syntax.