繁体   English   中英

包含的jQuery在生产模式下不起作用引发`not a function`错误

[英]Included jQuery not works under production mode raise `is not a function` error

我将jquery.placeholder.js放在assets/javascripts文件夹下

然后在我的coffeescript文件中应用该功能,即可正常工作。

$(document).ready ->
  $('input, textarea').placeholder();

但是,当我通过RAILS_ENV=production rails s在生产模式下运行时

在Firebug控制台上引发not a function error 在此处输入图片说明

我把其他相关文件放在要点上

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.

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