Bootstrap modal:不是一个函数
2022-08-30 04:12:01
我的页面中有一个模式。当我尝试在Windows加载时调用它时,它会将错误打印到控制台,该错误显示:
$(...).modal is not a function
这是我的模态HTML:
<div class="modal fade" id="prizePopup" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title" id="myModalLabel">
This Modal title
</h4>
</div>
<div class="modal-body">
Add some text here
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">
Submit changes
</button>
</div>
</div>
</div>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
这是我的JavaScript,在加载窗口时运行它:
<script type="text/javascript">
$(window).load(function() {
$('#prizePopup').modal('show');
});
</script>
如何解决此问题?