Getting JQuery and Prototype to place nice

29 May 2009, by Michael Cindrić

If you want to use JQuery in your rails application but still want prototype working as well there is a simple way to make sure they play nice and work side by side. All you have to do after you include your JQuery includes code is have the following

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

Now all you have to do to use jquery is use "$j" instead of just "$" and your good to go. To use just the standard prototype library is still just "$". Simple isn't it


Cookies help us deliver our services. By using our services, you agree to our use of cookies.