twitter-bootstrap Bootstrap 3 - jQuery 未定义错误?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18495977/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 18:07:08  来源:igfitidea点击:

Bootstrap 3 - jQuery is not defined Error?

twitter-bootstrap

提问by Mark

I get this error when viewing my Bootstrap website with the FF Error Console

使用 FF 错误控制台查看我的 Bootstrap 网站时出现此错误

Error: ReferenceError: jQuery is not defined Source File: http://localhost/cap3boot/js/bootstrap.jsLine: 6

错误:ReferenceError:jQuery 未定义源文件:http://localhost/cap3boot/js/bootstrap.js行:6

All my JS files are linking to the correct directories.

我所有的 JS 文件都链接到正确的目录。

Drop-down menus seem to work ok. Should I be concerned? Any ideas?

下拉菜单似乎工作正常。我应该担心吗?有任何想法吗?

回答by Jordan

You need to include the jQuery JS file before you include bootstrap.js. It can't be afterwards.

在包含 bootstrap.js 之前,您需要包含 jQuery JS 文件。以后不可能了。

回答by Mark

I have fixed the problem. It was something really simple.

我已经解决了这个问题。这是一件非常简单的事情。

The two js files for HTML shim were not linked correctly, causing the error.

HTML shim 的两个js 文件没有正确链接,导致错误。

This is before

这是之前

<script src="../assets/js/html5shiv.js"></script>
<script src="../assets/js/respond.min.js"></script>

After. Fixed.

后。固定的。

<script src="assets/js/html5shiv.js"></script>
<script src="assets/js/respond.min.js"></script>