开发者

JQuery + rails problem

I'm new to JQuery and so far I'm using prototype. But now I want to use JQuery and the thing is I done want to change my old code, which uses prototype

I installed jrails plugin also

my question is can i use

new Ajax.Updater etc.. kind of methods with JQuery (having the jrails plugin installed)

(it doesnt work for me)

BTW - I'm gettin开发者_JAVA技巧g JQuery from here http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js

thanks in advance

cheers sameera


I'm not sure if I understand your question completely but it seems to me that you are asking if you can use both Prototype and jQuery because you don't want to have to change all your old code. The best thing to do would be to put jQuery in noConflict mode. Under your inclusion of the jquery file from google, just do this:

<script>
  var $j = jQuery.noConflict();
</script>

That way jQuery won't step on Prototype's toes. instead of calling jQuery with a $ you'd use $j for example:

$j('#sidebar').hide();

I hope that helps... if indeed that's what you were asking.


I found that jrails was acting strange for me a few weeks ago. I discovered that the gem version solved my problems. Try installing it as a gem (if you're currently running it as a plugin) and see what happens.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜