Mih*_*nut 2 javascript asp.net-mvc twitter-bootstrap bootbox
我正在使用bootbox图书馆。我有一个按钮叫做Delete。
$('body').on("click", ".deleteDiagnostic", function () {
var id = $(this).attr("data-diagnosticID");
var currentRow = $(this).closest('tr');
bootbox.confirm("Are you sure want to delete?", function (result) {
if (result == true) {
//code here
}
});
});
Run Code Online (Sandbox Code Playgroud)
我也在使用PartialView,并且包含按钮的页面是动态加载的。有时当我点击时,bootbox 会打开多次,我不知道为什么。
PS:当我PartialView第一次加载时它运行良好,但是当我加载PartialView多次时,点击时会bootbox出现多次button。
请尝试像这样修改您的代码:
$('body').on("click", ".deleteDiagnostic", function (evt) {
evt.stopImmediatePropagation();
var id = $(this).attr("data-diagnosticID");
var currentRow = $(this).closest('tr');
bootbox.confirm("Are you sure want to delete?", function (result) {
if (result == true) {
//code here
}
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
880 次 |
| 最近记录: |