I think that the best solution is to use the option dialogClass
.
An extract from jquery UI docs:
during init : $('.selector').dialog({ dialogClass: 'noTitleStuff' });
or if you want after init. :
$('.selector').dialog('option', 'dialogClass', 'noTitleStuff');
So i created some dialog with option dialogClass='noTitleStuff' and the css like that:
.noTitleStuff .ui-dialog-titlebar {display:none}
too simple !! but i took 1 day to think why my previous id->class drilling method was not working. In fact when you call .dialog()
method the div you transform become a child of another div (the real dialog div) and possibly a 'brother' of the titlebar
div, so it's very difficult to try finding the latter starting from former.
I figured out a fix for dynamically removing the title bar.
$("#example").dialog(dialogOpts);
// remove the title bar
$(".ui-dialog-titlebar").hide();
This will remove all elements with the class 'ui-dialog-titlebar' after the dialog box is rendered.
I believe you can hide it with CSS:
.ui-dialog-titlebar {
display: none;
}
Alternatively, you can apply this to specific dialogs with the dialogClass
option:
$( "#createUserDialog" ).dialog({
dialogClass: "no-titlebar"
});
.no-titlebar .ui-dialog-titlebar {
display: none;
}
Check out "Theming" the Dialog. The above suggestion makes use of the dialogClass
option, which appears to be on it's way out in favor of a new method.
I use this in my projects
$("#myDialog").dialog(dialogOpts);
// remove the title bar
$("#myDialog").siblings('div.ui-dialog-titlebar').remove();
// one liner
$("#myDialog").dialog(dialogOpts).siblings('.ui-dialog-titlebar').remove();
This worked for me:
$("#dialog").dialog({
create: function (event, ui) {
$(".ui-widget-header").hide();
},
Try using
$("#mydialog").closest(".ui-dialog-titlebar").hide();
This will hide all dialogs titles
$(".ui-dialog-titlebar").hide();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With