选择的轨道错误不是函数 [英] chosen-rails error chosen is not a function
问题描述
我正在使用selected-rails将selected.js与rails资产管道集成
I am using chosen-rails for integration of chosen.js with rails asset pipeline
我已将其包含在我的Gemfile中
I have included in my Gemfile
gem 'chosen-rails'
然后
bundle install
在我的application.js中
in my application.js I have
//= require jquery
//= require jquery_ujs
//= require chosen-jquery
//= require_self
在我的application.css中
in my application.css I have
*= require chosen
页面根据需要加载js
The page loads the js as required
/assets/jquery.js?body=1
/assets/jquery_ujs.js?body=1
/assets/lib/select-parser.js?body=1
/assets/chosen.jquery.js?body=1
但我尝试使用selected()函数,它给出选择的错误不是函数
But I I try to use the function chosen() it gives the error chosen is not a function
$('#whatever').chosen();
我已经在页脚中尝试了上述方法.内部的jQuery准备就绪..内部的firebug控制台..似乎没有任何工作.可能是什么问题?
I have tried the above in the footer. inside Jquery ready.. inside firebug console.. nothing seems to work. What can possibly be the issue ???
推荐答案
我意识到问题不在于jQuery或资产管道,也不在于selected-rails gem,这是服务器配置问题,并且由于错误而提供了错误的文件nginx配置.
I realized the problem was not with jQuery or asset pipeline or the chosen-rails gem instead it was a server configuration issue and wrong files were being served due to bad nginx configuration.
这篇关于选择的轨道错误不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!