SQLTerminal.app
now available

XPath.app
now available
Want fresh tech tips in your inbox?

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
Tagged w/ #jquery #prototype #railsprogramming

Apps I've Built

XPath Expression Editor
Practice and improve your XPath skills with XPath Editor
Click to buy on the App Store
Photo Location Changer
Easily change the location on your photos and videos
Click here for more info about the app
Photo Date Changer
Easily change the dates and times on your photos and videos
Click here for more info about the app
VocabReminder
English dictionary with notifications so you won't forget what you're studying!
Click here for more info about the app
VocabQuiz
The app that quizzes and scores you on your vocabulary!
Click here for more info about the app