Remove close button on jQueryUI Dialog? – Stack Overflow

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

Tags: , ,

3 Responses

  1. There is even a simpler way that is re-usable.
    .no-close .ui-dialog-titlebar-close {display: none }
    $( “.selector” ).dialog({ dialogClass: ‘no-close’ });

  2. 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.

  3. 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.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*