Easily build a great vocabulary without studying! Now on the App Store!
Click here for more info about the app

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();
  //... do something
Tagged w/ #jquery #prototype #railsprogramming