Topic: Transitioning your Rails JS from Prototype to JQuery, step-by-step
I started poking around for a quick step-by-step on how to change your JS library from Prototype to JQuery and found a few items, but they still took some manipulating. Here are the steps if you want to try it yourself!
**disclaimer** This works for transitioning rails 3 JS libraries from Prototype to JQuery. Not sure if it works for rails 2. Also, you can feel free to transition using a gem but I wanted to do it manually.
And that's it! You shouldn't need to mess with any other files to get this to work. To test out your work, BE SURE TO RESTART YOUR WEB SERVER and load up a page with a delete button. You'll see the button works as planned - if the delete button doesn't work, you messed up. Also, if you view the source of the page, you'll notice that the JQuery library is loaded up.
Oh, if you have other functions that you built using Prototype, you can typically get them to work by: 1) adding a # in front of the CSS selector, and 2) replacing the Prototype method with the appropriate JQuery method. For example, replacing Prototype's 'update' method with JQuery's 'html' (as easy as replacing the word .update with .html) ...
Ryanb's RAILSCASTS does an excellent job of explaining this.
Hope this helps!
Last edited by imacobrabuilder (2011-06-16 12:40:39)