ripper234
ripper234

Reputation: 230346

How to make jquery-ui-dialog not have a close button?

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)?

Upvotes: 3

Views: 4924

Answers (3)

Dmitri Mogilevski
Dmitri Mogilevski

Reputation: 471

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.

Upvotes: 0

Chris
Chris

Reputation: 1112

This may solve your Problem:

       $("#dialogId").dialog({
           closeOnEscape: false,
           open: function(event, ui) { $(".ui-dialog-titlebar-close", ui.dialog).hide(); }
       });

Upvotes: 6

Barry Chapman
Barry Chapman

Reputation: 6780

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.

Upvotes: 1

Related Questions