简体   繁体   English

入门:Bootstrap的JavaScript需要jQuery

[英]Uncaught: Bootstrap's JavaScript requires jQuery

I have included jquery and bootstrap.min.js file in my footer section or it means i have my all script tag at the bottom of the code. 我在页脚部分包含了jquery和bootstrap.min.js文件,或者这意味着我的所有脚本标签都位于代码底部。 But when i am loading my page the browser console throw an error says : Uncaught Error: Bootstrap's JavaScript requires jQuery. 但是,当我加载页面时,浏览器控制台会抛出一个错误消息: 未捕获的错误:Bootstrap的JavaScript需要jQuery。 I am including these files locally like below:- 我在本地包含这些文件,如下所示:-

</footer>
<script src="http://127.0.0.1/ems_ci/assets/js/jquery.js" type="text/javascript"></script>
<script src="http://127.0.0.1/ems_ci/assets/js/bootstrap.min.js" type="text/javascript"></script>
</body>
</html>

It's uncommon to use localhost or 127.0.0.1 for a file path. 使用localhost127.0.0.1作为文件路径并不常见。 Use relative path instead. 请改用relative path

Regarding script position: you can leave them in the footer, that will speed up page loading, but make sure any JavaScript code you execute is AFTER jquery/bootstrap in the dom. 关于脚本位置:您可以将它们放在页脚中,这将加快页面加载速度,但请确保您执行的任何JavaScript代码在dom之后是jquery / bootstrap。 And don't forget to wrap your code inside a document ready jquery function 并且不要忘记将代码包装在document ready jquery函数中

To begin, you must change the location of the tag 'script' into the tag 'head'. 首先,必须将标签“ script”的位置更改为标签“ head”。 after this, you must change the location of your javascript scripts to your project directory. 之后,必须将javascript脚本的位置更改为项目目录。 Finally, you change the value of the 'src' attribute to: Ex: 最后,将“ src”属性的值更改为:例如:

  • src="../js/jquery.js" src =“ ../ js / jquery.js”
  • src="../js/bootstrap.min.js" src =“ ../ js / bootstrap.min.js”

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未捕获的错误:Bootstrap 的 JavaScript 需要 jQuery - Uncaught Error: Bootstrap's JavaScript requires jQuery Bootstrap设置错误:未捕获ReferenceError:未定义jQuery和Uncaught错误:Bootstrap的JavaScript需要jQuery - Bootstrap Set Up Errors: Uncaught ReferenceError: jQuery is not defined & Uncaught Error: Bootstrap's JavaScript requires jQuery bootstrap.min.js:6未捕获的错误:Bootstrap的JavaScript需要bootstrap.min.js:6上的jQuery - bootstrap.min.js:6 Uncaught Error: Bootstrap's JavaScript requires jQuery at bootstrap.min.js:6 bootstrap.js:未捕获的错误:Bootstrap的JavaScript需要jQuery 1.9.1或更高版本,但低于版本3 - bootstrap.js: Uncaught Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3 未捕获的错误:Bootstrap 的 JavaScript 需要 electron 应用程序中 bootstrap.min.js:6 处的 jQuery - Uncaught Error: Bootstrap's JavaScript requires jQuery at bootstrap.min.js:6, in an electron app 未捕获的错误:Bootstrap的JavaScript需要jQuery 1.12.4或更高版本,但日期时间选择器低于jQuery 3。 - Uncaught Error: Bootstrap's JavaScript requires jQuery version 1.12.4 or higher, but lower than version 3 in date time picker Bootstrap的JavaScript需要在vue 2.5中使用jQuery - Bootstrap's JavaScript requires jQuery in vue 2.5 Bootstrap 的 JavaScript 需要 jQuery - Reactjs - Bootstrap's JavaScript requires jQuery - Reactjs Ember Fastboot-Bootstrap的Javascript需要jQuery吗? - Ember Fastboot - Bootstrap's Javascript requires jQuery? Webpack bundle - Bootstrap的JavaScript需要jQuery - Webpack bundle - Bootstrap's JavaScript requires jQuery
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM