我有一个用于删除确认的模态窗口。不知怎的,我无法关闭这个模态窗口。以下是我编码的方式。有没有人知道我做错了什么?
$('#delpkgdtlPrompt').on('show.bs.modal', function(event) {
$('#AddPkgItm').modal('hide');
var button = $(event.relatedTarget); // Button that triggered the modal
var pkgid = button.data('pkgid');
var pkgdtldesc = button.data('pkgdtldesc');
var dataString = 'pkgid=' + pkgid;
alert(dataString);
var modal = $(this);
})
$(document).on("click", ".btncancel", function(e) {
e.preventDefault()
$('#delpkgdtlPrompt').modal('hide');
$('#AddPkgItm').modal('show');
});

<div class="modal fade" id="delpkgdtlPrompt" tabindex="-1" role="dialog" aria-labelledby="delpkgdtlPromptLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span>
</button>
<h2 class="modal-title text-center" id="delpkgdtlPromptLabel">Delete confirmation</h2>
</div>
<form action="" method="post" enctype="multipart/form-data" class="form-horizontal" id="frmdelpkgdtl">
<div class="modal-body">
<div id="pkgdtldesc" name="pkgdtldesc">
<p>You are about to delete the record</p>
</div>
</div>
<div class="modal-footer">
<div class="col-sm-offset-3 col-sm-9">
<button name="btncancel" id="btncancel" type="submit" class="btncancel btn btn-default"><i class="fa fa-undo"></i> Cancel</button>
<button name="btndelpkgdtl" id="btndelpkgdtl" type="submit" class="clsdelpkgdtl btn btn-warning"><i class="fa fa-trash"></i> Delete</button>
</div>
</div>
</form>
</div>
</div>
</div>
&#13;
我非常确定取消按钮的点击事件已被触发,因为在单击按钮后会显示另一个模态窗口(AddPkgItm)。只是确认不会消失。