3

I didn't find this in the documentation.

Should I just make the close button display:none with css, or is there a clean way in the API to make a dialog without the X button (top-right)?

ripper234
  • 222,824
  • 274
  • 634
  • 905
  • I'm pretty sure this is not possible to toggle via parameters. It makes no sense to provide dialogs without closing buttong/possibility. This wouldn't be good for usability reasons. If you need this for design purposes it's okay to do this via CSS. – Smamatti Feb 01 '12 at 09:39
  • @Smamatti - the dialog is part of a wizard, where there's one way to proceed - and simply closing the dialog is not an option at this point. – ripper234 Feb 01 '12 at 09:41
  • This is a duplicate of http://stackoverflow.com/questions/9093486/dynamically-choosing-the-close-effect-on-a-jquery-ui-dialog – Barry Chapman Feb 01 '12 at 09:41
  • Duplicate of http://stackoverflow.com/questions/896777/remove-close-button-on-jqueryui-dialog – Chris Feb 01 '12 at 09:46
  • @BarryChapman - wtf? No it really isn't. – ripper234 Feb 01 '12 at 09:46
  • But @Chris is right. Voting to close. – ripper234 Feb 01 '12 at 09:47

3 Answers3

6

This may solve your Problem:

       $("#dialogId").dialog({
           closeOnEscape: false,
           open: function(event, ui) { $(".ui-dialog-titlebar-close", ui.dialog).hide(); }
       });
Chris
  • 1,092
  • 2
  • 19
  • 39
1

There is no option to disable the 'X' button. You would need to add css to display none/hide() the element with the class 'ui-icon-closethick' when it is loaded and opened.

Barry Chapman
  • 6,690
  • 3
  • 36
  • 64
0

For some reason .hide() did not work for me. This did:

$('#divMsg').dialog({ title: 'Please wait...',
                      modal: true,
                      closeOnEscape: false,
                      open: function (event, ui) { $(".ui-dialog-titlebar-close", ui.dialog).css('display', 'none'); } }).text('Text To Display').css('background', 'white');

This code snippet also shows how to set the title and text of the dialog box -- I am using it as a modal notification window and closing it when my AJAX call completes.

Dmitri Mogilevski
  • 426
  • 1
  • 5
  • 7