[英]Included jQuery not works under production mode raise `is not a function` error
I put the jquery.placeholder.js
under assets/javascripts
folder 我将
jquery.placeholder.js
放在assets/javascripts
文件夹下
then apply the function in my coffeescript file and works fine. 然后在我的coffeescript文件中应用该功能,即可正常工作。
$(document).ready ->
$('input, textarea').placeholder();
However, When I run in production mode by RAILS_ENV=production rails s
但是,当我通过
RAILS_ENV=production rails s
在生产模式下运行时
Raise not a function error
on Firebug console 在Firebug控制台上引发
not a function error
I put other related files on gist 我把其他相关文件放在要点上
https://gist.github.com/poc7667/7576566 https://gist.github.com/poc7667/7576566
取消注释行:config / enviroments / production.rb中为50,并在其中添加jquery.placeholder.js
以对其进行预编译
config.assets.precompile += %w( jquery.placeholder.js )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.