jQuery   发布时间:2022-04-19  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了jquery – 为什么不在第二次打开bootstrap模式对话框?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我使用了一个通过单击按钮打开的引导模式对话框.
 当我第一次点击按钮时,模态打开;通过第二次单击,模态对话框不显示,此错误显示在firebug consol中:

TypeError: $(...).modal is not a function
$(".bs-modal-dialog").modal();

我该怎么解决?谢谢…@H_674_11@

这些是我的代码:@H_674_11@

<div class="modal fade bs-modal-dialog" id="modalDialog" tabindex="-1" role="dialog" 
 aria-labelledby ="mysmallModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm">
    <div class="modal-content">
        <div class="modal-header">

                 <button class="close" aria-hidden="true" data-dismiss="modal" type="button">×</button>
                  <h4 id="mysmallModalLabel" class="modal-title"></h4>
        </div>
        <div class="modal-body">
        </div>
    </div>
</div>
<script>

function EditCompany(CoId) { 


    var link="@Url.Action("EditCompany","Companies",new { area = "AdminsArea",CoId = "-1"})";

        link=link.replace("-1",CoId);
        $(".bs-modal-dialog").modal('show');
        $(".modal-body").load(link);
        $(".modal-content > .modal-header> #mysmallModalLabel").text("Edit Company");

}
<input type="button" name="EditCompany" value="Edit"  onclick="EditCompany(@co.CompanyId)" class="btn btn-success"/>

解决方法

你不需要任何JavaScript来做这件事,Bootstrap已经附带了html attribute for that.

所有你需要做的就包括data-toggle =“modal”data-target =“#mymodal”,它应该触发你的模态.@H_674_11@

bootply here@H_674_11@

大佬总结

以上是大佬教程为你收集整理的jquery – 为什么不在第二次打开bootstrap模式对话框?全部内容,希望文章能够帮你解决jquery – 为什么不在第二次打开bootstrap模式对话框?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。