javascript - 同一页面中的引导模型对话不起作用
问题描述
我有一个带有 jQuery 数据表的 Bootstrap 3 模型对话。如果第一个打开和关闭第二个背景消失而没有对话并冻结。甚至鼠标点击也不起作用。
我的动作链接
@Html.ActionLink("Get File ", "_ViewFIles", "POPM_Trn_Job", null, new { @class = "modal-link btn btn-success" })
@Html.ActionLink("Get Shared ", "GetSharedWithMe", "POPM_Trn_Job", null, new { @class = "modal-link2 btn btn-success" })
我的对话
<div id="modal-container" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-content">
</div>
<div id="modal-container-Share" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-content">
</div>
</div>
我的第一个 jQuery
$(function () {
$('body').on('click', '.modal-link', function (e) {
e.preventDefault();
$(this).attr('data-target', '#modal-container');
$(this).attr('data-toggle', 'modal');
});
$('body').on('click', '.modal-close-btn', function () {
$('#modal-container').modal('hide');
});
$('#modal-container').on('hidden.bs.modal', function () {
$(this).removeData('bs.modal');
});
$('#CancelModal').on('click', function () {
return false;
});
});
第二个功能
` $(function () {
$('body').on('click', '.modal-link2', function (e) {
e.preventDefault();
$(this).attr('data-target', '#modal-container-Share');
$(this).attr('data-toggle', 'modal');
});
$('body').on('click', '.modal-close-btn', function () {
$('#modal-container-Share').modal('hide');
});
$('#modal-container-Share').on('hidden.bs.modal', function () {
$(this).removeData('bs.modal');
});
$('#CancelModal').on('click', function () {
return false;
});
});
我做错了什么?
解决方案
我解决了这个问题。我的脚本文档部分充满了三个 jQuery 引用;删除它们解决了这个问题。我猜是因为每个部分视图都带有引用,而主页也有一个引用,因为每个视图都必须使用 jQuery 数据表。
推荐阅读
- r - 带折线的分组堆积条形图
- ruby-on-rails - 排除特定日期之前的记录
- python - 使用带有字典值的 .find 来组织文件
- azure - Azure App Service Plan D1 - 240 分钟如何使用?
- python - 正则表达式模式搜索日期格式 MMDDYYYY(python)
- tensorflow2.0 - 如何解决此问题安装问题
- amazon-web-services - ModuleNotFoundError:AWS Glue 中没有名为“aiohttp”的模块
- javascript - 从我的应用程序共享链接时如何查看whatsapp缩略图
- python - Python中的路径按行选择
- python - 将雅典娜连接到超集