如何删除jQueryUI创建的对话框上的关闭按钮(右上角的X)?


当前回答

我觉得这样更好。

open: function(event, ui) {
  $(this).closest('.ui-dialog').find('.ui-dialog-titlebar-close').hide();
}

其他回答

我觉得这样更好。

open: function(event, ui) {
  $(this).closest('.ui-dialog').find('.ui-dialog-titlebar-close').hide();
}

您可以使用以下代码删除关闭按钮。还有其他的选择,你可能会觉得有用。

$('#dialog-modal').dialog({
    //To hide the Close 'X' button
    "closeX": false,
    //To disable closing the pop up on escape
    "closeOnEscape": false,
    //To allow background scrolling
    "allowScrolling": true
    })
//To remove the whole title bar
.siblings('.ui-dialog-titlebar').remove();

对于停用类,短代码:

$(".ui-dialog-titlebar-close").hide();

可以使用。

document.querySelector('.ui-dialog-titlebar-close').style.display = 'none'
$(".ui-button-icon-only").hide();