James' Blog

James’ personal blog
Previous Post:   Next Post:

Using JQuery + Prototype in Rails

Original info was found here.  It was posted about 3 years ago, so JQuery has changed a little since then with the implementation of JQuery.noconflict().

In a nutshell, just in clude JQuery first and then include the other libraries(s) that may use the $( function. Make sure you call JQuery stuff with JQuery(xxx) instead of $( from now on.  You include JQuery in rails usually in your main layout file by typing:

<%= javascript_include_tag ‘jquery’ %>

Make sure the jquery download files are in your /public/javascript directory of your project.

The JQuery site suggested adding the noconflict at the end of the jquery.js file, but instead I did it this way in the layout file.

<script>jQuery.noConflict(); </script>

Tags:

Posted in Ruby on Rails 9 months ago at 2:10 pm.

Add a comment

Comments are closed.