简体   繁体   English

twitter-bootstrap-rails未捕获的TypeError / $不是函数

[英]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.

相关问题 jQuery lib包含与rails3和twitter-bootstrap-rails的冲突 - jQuery lib include conflict with rails3 and twitter-bootstrap-rails Twitter Uncaught TypeError:undefined不是一个函数 - Twitter Uncaught TypeError: undefined is not a function 未捕获的TypeError:$(...).slider不是Bootstrap-Slider-Rails的函数 - Uncaught TypeError: $(…).slider is not a function with Bootstrap-Slider-Rails BootStrap:未捕获的TypeError:$(...)。datetimepicker不是函数 - BootStrap : Uncaught TypeError: $(…).datetimepicker is not a function Bootstrap - “未捕获的TypeError:undefined不是函数” - Bootstrap - “Uncaught TypeError: undefined is not a function” Rails Uncaught TypeError:$(...)。modal不是函数 - Rails Uncaught TypeError: $(…).modal is not a function Twitter引导程序:未捕获的TypeError:对象modal1没有方法“切换” - Twitter Bootstrap: Uncaught TypeError: Object modal1 has no method 'toggle' Laravel 7 bootstrap datepicker:未捕获的类型错误:$(...).datepicker 不是函数 - Laravel 7 bootstrap datepicker: Uncaught TypeError: $(…).datepicker is not a function Bootstrap FullCalendar未捕获的TypeError:undefined不是函数 - Bootstrap FullCalendar Uncaught TypeError: undefined is not a function Uncaught TypeError:未定义不是日期选择器引导程序的函数 - Uncaught TypeError: undefined is not a function for date picker bootstrap
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM