0

Possible Duplicate:
Can I use multiple versions of jQuery on the same page?

I have a website built in 2008, and i used many jquery plugins, those days it was jquery 1.3.

Now last week i was trying to upgrade to jquery 1.7 and when i do that, i had few issues.

if i upgrade to the new version i have some plug-ins not working, so obvious solution is to make sure you use the latest plugins, .. well it was not that simple, some plugins don't have a version for this jquery version.

So i now have to upgrade the jquery but cant upgrade because of the plugins, and i cant use new plugins too because its too old..

So my questions is

is there way to tell jquery to use this version(after including the both version) and is there a way to tell the jquery or html page to use a version specified by me?

Community
  • 1
  • 1
mahen3d
  • 7,047
  • 13
  • 51
  • 103
  • 1
    Yes, by namespacing older jQuery versions in conjunction with [`jQuery.noConflict(true);`](http://api.jquery.com/jQuery.noConflict/). – Rob W Jul 22 '12 at 12:50
  • Check my answer of this question.http://stackoverflow.com/questions/8961120/script-reference-causes-conflict/8961203#8961203 – xdazz Jul 22 '12 at 12:53

1 Answers1

1
<script src="jquery-1.2.6.js" type="text/javascript"></script>
<script src="plugin-that-needs-1.2.6.js" type="text/javascript"></script>
<script src="jquery-1.4.2.js" type="text/javascript"></script>
<script src="plugin-that-needs-1.4.2.js" type="text/javascript"></script>

<script type="text/javascript">
      var newJQuery = jQuery.noConflict(true),
            oldJQuery = jQuery;

      (function ($) {

            // code that needs 1.4.2 goes here

}(newJQuery));

      (function ($) {

            // code that needs 1.2.6 goes here

}(oldJQuery));

      // code that needs oldJQuery and newJQuery can go here
</script>

The same question was asked here: http://forum.jquery.com/topic/how-to-remove-jquery-version-conflict

The Alpha
  • 143,660
  • 29
  • 287
  • 307
Tarik
  • 79,711
  • 83
  • 236
  • 349
  • If you want to run code on page load anyway, you can also do `newJQuery(function($) { ... });` and `oldJQuery(function($) { ... });` – Felix Kling Jul 22 '12 at 12:57