【发布时间】:2018-05-11 02:37:09
【问题描述】:
我正在使用jquery-confirm 插件和 Bootstrap 3。确认工作正常,但如果我在单击确认按钮之前打开页面上的任何引导模式,则会弹出两个确认框。如果我在单击确认按钮之前打开引导模式 5 次,它会同时触发五个确认框,一个接一个地叠加。为什么会这样?
这是我的js:
$('body').on('click', '.confirm', function(e) {
e.preventDefault();
var form = this.closest("form");
$.confirm({
title: "confirmation",
content: "Are you sure?",
buttons: {
'confirm': {
text: 'proceed',
keys: ['enter'],
btnClass: 'btn-red',
action: function () {
form.submit();
}
},
'cancel': {
text: 'cancel',
action: function () {
return false;
}
},
}
});
});
我做错了什么?
【问题讨论】:
-
除非您在 sn-p 中复制您的问题,或者至少提供所有依赖项,例如您正在使用此脚本处理的 HTML,否则没人能猜到这个问题
标签: javascript jquery bootstrap-modal jquery-confirm