[英]twitter-bootstrap-rails Uncaught TypeError / $ is not a function
While developing a rails app, I was in the google chrome inspect element console testing an ajax link when all of the sudden I noticed 12 errors of the same kind: 在开发rails应用程序的时候,我在谷歌chrome检查元素控制台测试ajax链接,突然间我注意到12个同类错误:
I have no clue what is happening here, but my app works just fine regardless. 我不知道这里发生了什么,但我的应用程序工作正常,无论如何。 However, When I pull my app up in firefox, my app does not even load.
但是,当我在firefox中启动我的应用程序时,我的应用程序甚至没有加载。 I get stopped and this error pops up:
我停下来,弹出这个错误:
I dont even know what else to say here because I am completely stumped. 我甚至不知道还有什么要说的,因为我完全被难倒了。
Ok, I found what was the problem was. 好的,我发现问题是什么。 When trying to get the bootstrap dropdown buttons to work the other day, I have rearranged the application.js folder to load bootstrap before jquery.
当我试图让bootstrap下拉按钮在前几天工作时,我重新安排了application.js文件夹以在jquery之前加载bootstrap。 I changed this:
我改变了这个:
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require_tree .
to this: 对此:
//= require twitter/bootstrap
//= require jquery
//= require jquery_ujs
//= require_tree .
At the time, this fixed the bootstrap dropdown problem. 当时,这解决了引导下拉问题。 However, I now I realize that when bootstrap calls jquery, it will not have been loaded yet.
但是,我现在意识到当bootstrap调用jquery时,它还没有被加载。 Thus, the error
$ function does not exist
. 因此,错误
$ function does not exist
。 Just changed the lines back to the proper order and all is now well. 只是将线路改回正确的顺序,现在一切都很顺利。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.