Javascript 询问用户是否真的要关闭引导模式
我有一个引导模式。当它关闭时,会执行一些指令。但现在我想问用户是否真的想关闭它(带有确认窗口),我能做什么 这是我目前的代码Javascript 询问用户是否真的要关闭引导模式,javascript,twitter-bootstrap-3,modal-dialog,hide,confirm,Javascript,Twitter Bootstrap 3,Modal Dialog,Hide,Confirm,我有一个引导模式。当它关闭时,会执行一些指令。但现在我想问用户是否真的想关闭它(带有确认窗口),我能做什么 这是我目前的代码 $('#modal').on("hide.bs.modal", function (e) { //Instructions to execute when the modal is closed }); 像这样 $('#modal').on("hide.bs.modal", function (e) { if(confirm("Are you sure,
$('#modal').on("hide.bs.modal", function (e) {
//Instructions to execute when the modal is closed
});
像这样
$('#modal').on("hide.bs.modal", function (e) {
if(confirm("Are you sure, you want to close?")) return true;
else return false;
});
或者,就像这样:
$('#modal').on("hide.bs.modal", function (e) {
if(!confirm("Are you sure, you want to close?")) return false;
});
是的,这正是我需要的。谢谢这比我想象的要容易:)很高兴,我能帮助你。
$('#modal').on("hide.bs.modal", function (e) {
//Instructions to execute when the modal is closed
if(!confirm("Are you sure, you want to close?")) return false;
});