开发者

Jquery doesn't work with jquery-rails gem

I did bundle and generate install and now I have the jquery's files instead of prototype

I can see from mozilla firebug that the jquery's files are included, however I can't use jQuery or $ functions, the app/mozilla console don't know them.

Any suggestions how to fix this?

I'开发者_运维百科m using jquery-rails 1.0.12 and rails 3.0.8


It would be great if you could give more details but here are some things you can try:

  • Make sure that when you view the page source you can see the jQuery files are included. I usually have <%= javascript_include_tag :defaults %> between the HEAD tags

  • You can test if everything is working by adding the following code:

    $(document).ready(function() { alert('hello world'); });

Hope this helps


Make sure the line below is commented out (in application.rb) and that you have restarted your server.

config.action_view.javascript_expansions[:defaults] = %w(jquery rails)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜