I used the bootstrap modal dialog that opens with the click of a button. When I press the button for the first time, the modal opens; a second press does not display the modal dialog box, and this error is displayed in the firebug console:
TypeError: $(...).modal is not a function
$(".bs-modal-dialog").modal();
how can i solve this? thank...
this is my code:
<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"/>
source
share