未捕获的ReferenceError:$未定义Bootsrap通知

时间:2017-10-08 15:21:16

标签: javascript jquery twitter-bootstrap

我只是将bootstrap的notify插件包含到我的页面中。当我打电话

 echo '<script>$( document ).ready(function() {$.notify("Hello World");});</script>';
控制台告诉我这个:

Uncaught ReferenceError: $ is not defined

以下是我的Javascript包含。

<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/bootstrap-notify.min.js"></script>
<script src="assets/js/select2.min.js"></script>
<script src="assets/js/contact.js"></script>
<script src="assets/js/smoothscroll.js"></script>
<script src="assets/js/counter.js"></script>
<script src="assets/js/page.js"></script>
<script src="assets/js/responsive-menu.js"></script>

1 个答案:

答案 0 :(得分:-1)

将你的jquery和boostrap js链接保留在head标签的顶部并再次测试。问题必须解决。 这通常是因为您的doc ready函数的加载时间早于jquery.js。

<html>
<header>
jquery.js and bootstrap.js at top here
</header>
<body>
</body>
all the remaining links
<script>
document ready here
</script>
<html>