Jquery 为什么不在第二次打开引导模式对话框?

Jquery 为什么不在第二次打开引导模式对话框?,jquery,twitter-bootstrap,asp.net-mvc-4,bootstrap-modal,Jquery,Twitter Bootstrap,Asp.net Mvc 4,Bootstrap Modal,我使用了通过单击按钮打开的引导模式对话框。 当我第一次点击按钮时,模态被打开;第二次单击时,模式对话框不显示,并且firebug控制台中显示此错误: TypeError: $(...).modal is not a function $(".bs-modal-dialog").modal(); 我怎样才能解决这个问题?谢谢 以下是我的代码: <div class="modal fade bs-modal-dialog" id="modalDialog" tabindex="-1" rol

我使用了通过单击按钮打开的引导模式对话框。 当我第一次点击按钮时,模态被打开;第二次单击时,模式对话框不显示,并且firebug控制台中显示此错误:

TypeError: $(...).modal is not a function
$(".bs-modal-dialog").modal();
我怎样才能解决这个问题?谢谢

以下是我的代码:

<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>

×


功能编辑公司(CoId){
var link=“@Url.Action”(“编辑公司”,“公司”,new{area=“AdminsArea”,CoId=“-1”})”;
链接=链接。替换(“-1”,CoId);
$(“.bs模态对话框”).modal('show');
$(“.modal body”).load(链接);
$(“.modal content>.modal header>#mySmallModalLabel”).text(“编辑公司”);
} 


您不需要任何JavaScript来实现这一点,Bootstrap已经附带了html

您所要做的一切包括
data toggle=“modal”data target=“#myModal”
,它应该会触发您的模态


您是否包含了支持js的组件,这些组件具有
bs模态对话框
?请注意:不要在
onClick
属性中使用内联js代码。在js代码中绑定一个事件。@Java\u用户是的,我添加了bootstrap.min.js,但bs modal dialog是我的自定义类名。
<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"/>