Test
Test

Reputation: 45

How to disable close button in the dialog

 jQ('#dvShiftDialog').dialog({
                        title : 'Confirm',
                        modal : true,
                        draggable : false,
                        resizable : false,
                        disabled : false,
                        closeOnEscape : false,
                        width : 400,
                        height : 325,
                        close : function() {
                            jQ('#dvShiftDialog').dialog("destroy");
                            jQ('#dvShiftDialog').remove();
                            jQ('div.ui-dialog').remove();
                        }
                    });

Upvotes: 1

Views: 1218

Answers (2)

Dom
Dom

Reputation: 40463

You can also do it like this....

$('#dvShiftDialog').dialog({
    title : 'Confirm',
    modal : true,
    width : 400,
    height : 325,
    open: function(event, ui) {
        $(this).parent().find(".ui-dialog-titlebar-close").hide();
    }
});

Upvotes: 0

SpYk3HH
SpYk3HH

Reputation: 22570

If you are referring to the "X" in the upper right corner (since, by your code, you technically don't have any "buttons") you can use the following:

open: function(e, ui) {
    jQ(this).siblings(".ui-dialog-titlebar").children(".ui-dialog-titlebar-close").hide();
}

Place it in your function as follows:

jQ('#dvShiftDialog').dialog({
    title: 'Confirm',
    modal: true,
    draggable: false,
    resizable: false,
    disabled: false,
    closeOnEscape: false,
    width: 400,
    height: 325,
    close: function() {
        jQ('#dvShiftDialog').dialog("destroy");
        jQ('#dvShiftDialog').remove();
        jQ('div.ui-dialog').remove();
    },
   open: function(e, ui) {
       jQ(this).siblings(".ui-dialog-titlebar").children(".ui-dialog-titlebar-close").hide();
   }
});

Upvotes: 2

Related Questions