Nov 19th, 2012
Certain aspects of Drupal will break if you update jQuery beyond a certain version. So, to use a higher version for your custom code and still use the old version for Drupal stuff (overlays, tabledrag, etc), you can take advantage of jquery noConflict() http://api.jquery.com/jQuery.noConflict/. It can be a little confusing if you have never used it before. Here's a breakdown.
- page loads "jquery.versionX.js"
- $ and jQuery belong to versionX
- you call your "jquery.versionY.js"
- now $ and jQuery belong to versionY, plus _$ and _jQuery that belongs to versionX
- var my_jQuery = jQuery.noConflict(true);
- now $ and jQuery belong to versionX, _$ and _jQuery are probably null, and my_jQuery is versionY
**drupal.info example**
scripts[] = [...]
scripts[] = scripts/jquery-1.7.1.min.js
scripts[] = scripts/foo.js
foo.js looks like this:
jQueryNoConflict = jQuery.noConflict(true); (function ($, Drupal, window, document, undefined) { Drupal.behaviors.jeffythemer = { attach: function () { // Your jQuery code here } }; })(jQueryNoConflict, Drupal, this, this.document);