简体   繁体   English

错误:Bootstrap的JavaScript需要jQuery

[英]Error: Bootstrap's JavaScript requires jQuery

When i run my site on mozilla i got this error above.Here some code snippet which might be helpful 当我在mozilla上运行我的网站时,我得到了上面的错误。这里有一些代码片段,可能会有所帮助

<script src="http://www.iclubz.com/js/jquery.js"></script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>

<script src="http://www.iclubz.com/js/readmore.min.js"></script>

<script src="http://www.iclubz.com/js/chosen.jquery.js"></script>

<script src="http://www.iclubz.com/js/jquery.validate.min.js"></script>

<script src="http://www.iclubz.com/js/fileinput.min.js"></script>

But it's work fine on chrome.I don't know why this problem are showing.I'll helpful if anyone tell me the reason 但它在chrome上工作正常。我不知道为什么会出现这个问题。如果有人告诉我原因,我会有所帮助

Thanks in advance 提前致谢

Edited : i forgot to mention that all my javascript are called in the bollom of the page 编辑 :我忘了提到我的所有javascript都在页面的bollom中调用

Make sure to load jquery.js file before loading bootstrap. 确保在加载bootstrap之前加载jquery.js文件。 This solved my problem. 这解决了我的问题。

That error can only be caused by one of three things: 该错误只能由以下三种情况之一引起:

  • Your JavaScript file is not being properly loaded into your page 您的JavaScript文件未正确加载到您的页面中

  • You have a botched version of jQuery. 你有一个拙劣的jQuery版本。 This could happen because someone edited the core file, or a plugin may have overwritten the $ variable. 这可能是因为有人编辑了核心文件,或者插件可能覆盖了$变量。

  • You have JavaScript running before the page is fully loaded, and as such, before jQuery is fully loaded. 您在页面完全加载之前运行JavaScript,因此,在jQuery完全加载之前。 You should check the Firebug net panel to see if the file is actually being loaded properly. 您应该检查Firebug网络面板以查看文件是否实际正确加载。

    If not, it will be highlighted red and will say "404" beside it. 如果没有,它将突出显示为红色并在其旁边显示“404”。 If the file is loading properly, that means that the issue is number 2. 如果文件正确加载,则表示问题为2。

Make sure all javascript code is being run inside a code block such as: 确保所有javascript代码都在代码块中运行,例如:

$(document).ready(function () {
  //your code here
});

你的第一次加载jquery.js(min)然后加载loadrap

<script src="/node_modules/bootstrap/dist/js/bootstrap.js"></script>

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM