Best way to remove the close button on jQuery UI dialog box widget?

后端 未结 2 1590
醉梦人生
醉梦人生 2021-02-04 01:23

What\'s the best way to remove the close button on the jQuery UI dialog box?

I do not wish people to be able to close the dialog box.

I\'m covering it on the cod

相关标签:
2条回答
  • 2021-02-04 01:33

    I found another solution, works for me:

    $("#divID").dialog({
       closeOnEscape: false,
       open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
    });
    
    0 讨论(0)
  • 2021-02-04 01:39

    I found this to be a good solution

    $("#myDialogID").dialog({
        closeOnEscape: false,
        beforeClose: function (event, ui) { return false; },
        dialogClass: "noclose"
    });
    

    Not altering the existing styles, instead adding a new bit:

    .noclose .ui-dialog-titlebar-close
    {
        display:none;
    }
    

    Adding the class ended up being quite an elegant method, as i'm "classing" the dialog as one that cannot be closed.

    0 讨论(0)
提交回复
热议问题