Our drupal site runs with jQuery version 1.2.1 which we have not upgraded.
The problem is this:
We need to add a new plugin named jQuery Tokeninput, but it's working only in latest jQuery versions. We tried adding the latest jQuery version with old version, but it produces weird results.
My question is, how to include the latest jQuery file without affecting the old jQuery plugins?
Method #1: (recommended)
You could do something like this:
And this way when you want something made with the new version of jquery instead of the
$
use$jq
.Method #2: (might break things on your site - not recommended)
In your
template.php
file:Be sure to only do this on the frontend of your site. It can mess up admin toolbars if they are dependent on Drupal's version of jQuery.
The following script...
is completely backward compatible with pre-existing scripts
should have no side effects (except for obvious side effect of adding an additional JS download)
How to use 2 versions of jQuery on the same page
See it in action here:
http://jsfiddle.net/dd94h/
Here's the entire HTML that you can drop in an html file to test
Just so you know, there is a jQuery update module which will update jQuery versions for you without you having to code it. Look into it if it's of interest but I don't think that the module keeps the old jQuery version but rather replaces it with the new one.
I might also suggest that you try upgrading the version of jQuery and just using the latest one to see if it does indeed break other functionalities.