How do I remove the close button (the X in the top left corner) on a dialog box created by jQueryUI?
You can use CSS to hide the close button.
What I mean is that CSS can be used directly instead of JavaScript
<style>
.ui-dialog-titlebar-close{
display: none;
}
</style>
Also I can not accept the answer I am not wrong but -1, I just tell you approach, I do not intend to tell you the specific answer.
I do not know if you have not heard of a proverb that is
"if you give man a fish,he will have a single meal,but if you teach man to fish, feed him whole life."
I have found this worked in the end (note the third line overriding the open function which find the button and hides it):
$("#div2").dialog({
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
the "best" answer will not be good for multiple dialogs. here is a better solution.
open: function(event, ui) {
//hide close button.
$(this).parent().children().children('.ui-dialog-titlebar-close').hide();
},
open: function(event, ui) { //hide close button. $(this).parent().children().children('.ui-dialog-titlebar-close').click(function(){ $("#dhx_combo_list").remove();
});
},
yaaaa.....its realy working ....I catched the close event of the dialog box. In above coading it is remove the div(#dhx_combo_list). great...thanks u all..
$("#div2").dialog({ closeOnEscape: false, open: function(event, ui) { $('#div2').parent().find('a.ui-dialog-titlebar-close').hide();} });