下面的代码片段允许我在被点击的按钮的回调函数中执行一些操作。但是,如何获得回调函数或类似的解决方法,以便在用户单击“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/