praneeth kumar
praneeth kumar

Reputation: 31

jQuery version conflict - load two versions same time

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?

Upvotes: 0

Views: 1045

Answers (1)

kosmos
kosmos

Reputation: 4288

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>

Upvotes: 3

Related Questions