gpt4 book ai didi

javascript - Bootbox:关闭对话框/点击 'X'按钮后的回调函数

转载 作者:可可西里 更新时间:2023-11-01 02:54:35 25 4
gpt4 key购买 nike

下面的代码片段允许我在被点击的按钮的回调函数中执行一些操作。但是,如何获得回调函数或类似的解决方法,以便在用户单击“X”按钮/关闭对话框时执行一些代码?

    bootbox.dialog({
title: "Woah this acts like an alert",
message: "Cool info for you. You MUST click Ok.",
buttons: {
sucess:{
label: "Ok",
callback: callback
}
}
});

callback(){//stuff that happens when they click Ok.}

我不想禁用/隐藏关闭按钮

closeButton: false,

最佳答案

为此有一个 onEscape 函数。

bootbox.dialog({
message: 'the msg',
title: "Title",
onEscape: function() {
// you can do anything here you want when the user dismisses dialog
}
});

关于javascript - Bootbox:关闭对话框/点击 'X'按钮后的回调函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29113222/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com