Using jQuery and Prototype Javascript Together with jQuery.noConflict();

To use the jQuery javascript framework in a Rails application, that also uses the Prototype framework for the same application, you’ll need to reassign the $() function for jQuery to another variable. This is very simple to do. Just make sure to include the jQuery library after you load your prototype defaults.

Here is the javascript to alias the $() function

script type="text/javascript"
  var $_ = jQuery.noConflict();
  $_(document).ready(function(){
  $_("a").click(function(){
  //... do something
  });
});
/script