How to remove close button on the jQuery UI dialog?

0 votes

How do I remove the close button (the X in the top-right corner) on a dialog box created by jQuery UI?

May 12 in JQuery by kartik
• 27,140 points
284 views

1 answer to this question.

0 votes

Hii,

I found this worked for me 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", ui.dialog || ui).hide();
    }
});

To hide the close button on all dialogs you can use the following CSS too:

.ui-dialog-titlebar-close {
    visibility: hidden;
}

Thank You!!

answered May 12 by Niroj
• 58,500 points

Related Questions In JQuery

0 votes
1 answer

How to attach callback to jquery effect on dialog show?

Hello, Try out the code using jQuery Promise object: $("#dialog").dialog({ ...READ MORE

answered May 29 in JQuery by Niroj
• 58,500 points
107 views
0 votes
1 answer

Error: cannot call methods on dialog prior to initialization; attempted to call method 'close'

Hello @kartik, Looks like your buttons are not ...READ MORE

answered Apr 28 in JQuery by Niroj
• 58,500 points
502 views
0 votes
1 answer

How to import jQuery UI using ES6/ES7 syntax?

Hii, Add a alias in webpack config: resolve: { ...READ MORE

answered Apr 28 in JQuery by Niroj
• 58,500 points
766 views
0 votes
1 answer

How to enable Bootstrap tooltip on disabled button?

Hii @kartik, You can wrap the disabled button ...READ MORE

answered May 12 in JQuery by Niroj
• 58,500 points
624 views
0 votes
1 answer

Why it is necessary to refresh CSRF token per form request?

Hello, Generating a new CSRF token for each ...READ MORE

answered Mar 19 in Laravel by Niroj
• 58,500 points
784 views
0 votes
1 answer

What is meant by passing the variable by value and reference in PHP?

Hello, When the variable is passed as value ...READ MORE

answered Mar 27 in PHP by Niroj
• 58,500 points
116 views
0 votes
1 answer

Connection with MySQL server using PHP. How can we do that?

Hey @kartik, You have to provide MySQL hostname, ...READ MORE

answered Mar 27 in PHP by Niroj
• 58,500 points
81 views
0 votes
1 answer

How to retrieve or obtain data from the MySQL database using PHP?

Hello kartik,  Actually there are many functions that  ...READ MORE

answered Mar 27 in PHP by Niroj
• 58,500 points
93 views
0 votes
1 answer
0 votes
1 answer

How can you disable scroll bars in the jQuery UI dialog box?

Hello @kartik, I solved the problem like this: .dialog({ ...READ MORE

answered May 29 in JQuery by Niroj
• 58,500 points
182 views