jQuery version conflict - load two versions same time

1k Views Asked by At

In my regular project setup we are using jQuery v1.6.2, but recently we have started to use Kendo UI plugin for charts; this plugin won't support the jQuery version v1.6.2, it works only with v1.7 or higher, so we are forced to load v1.7 also using noConflict.

Are there any side effects to my existing old code? Can we load and use two versions of jQuery at the same time?

1

There are 1 best solutions below

3
On

Yes, you can do it. Using jQuery.noConflict() you can make multiple versions of jQuery coexist on the same page:

<script src='jquery-1.3.2.js'></script>
<script>
    var jQ132 = jQuery.noConflict();
</script>
<script src='jquery-1.4.2.js'></script>
<script>
    var jQ142 = jQuery.noConflict();
</script>

extracted from jQuery forums

Later, you just use jQ16 instead of $, e.g.:

<script>
    jQ16.ready(function($) {
        // inside here, $ refers to jQ16
        $('#something').val(); // ...
    });
</script>