我得到了:
Uncaught TypeError: Object [object Object] has no method 'modalmanager'
在我的script.js文件中,我有:
$('#addShoplistModal').modal('toggle');
我的jsp页面代码:
<div class="modal hide fade" id='addShoplistModal'>
<div class='modal-header'>
<a class='close' data-dismiss='modal'>×</a>
<h3>Add Shopitem</h3>
</div>
<div class='modal-body'>
<form id="addShopitemForm">
<div id="name-error"></div>
<input type="text" id="name" placeholder="Name" />
<div id="quantity-error"></div>
<input type="text" id="quantity" placeholder="Quantity" />
</form>
</div>
<div class='modal-footer'>
<a class="btn" data-dismiss="modal">Cancel</a>
<a shoplistId="" id="add-shoplist" class="btn btn-primary">Add</a>
</div>
</div>
<script src="<spring:url value="/web/js/jquery-2.0.0.js" />"></script>
<script src="<spring:url value="/web/js/jquery.validate.js" />"></script>
<script src="<spring:url value="/web/js/bootstrap.js" />"></script>
<script src="<spring:url value="/web/js/bootstrap-modal.js" />"></script>
<script src="<spring:url value="/web/js/script.js" />"></script>
错误发生在
的bootstrap-modal.jsmanager = manager.appendModal ?
manager : $(manager).modalmanager().data('modalmanager');
请告诉我,如何解决这个问题。感谢。
答案 0 :(得分:7)
bootstrap.js
文件应该包含所有Bootstrap JavaScript功能,例如模式。因此,当您尝试第二次包含模态特征库时,没有必要,并且显然会破坏事物。只需删除bootstrap-modal.js
。
答案 1 :(得分:6)
我曾经遇到过同样的问题。检查是否已添加jQuery两次。如果是,请删除第二个jquery。它应该工作正常。