Lucian
Lucian

Reputation: 4001

use Kendo UI simultaneously with another jQuery version

The current jQuery version of the Kendo UI (Q3 2012) is 1.8.2.

I want to use this library on an existing site. The site already uses jQuery but with version 1.5.0 1.4.4. Upgrading this version to 1.8.2 is not an option because it breaks entire pages some components on some pages.

Can the two of them function simultaneously on the same site/page?

The Telerik.ASP.NET.Ajax used a proxy for jQuery that ensured that their controls always used the right jQuery library:

$telerik = $;

Does KendoUI have something similar?

Upvotes: 4

Views: 3224

Answers (1)

Kevin B
Kevin B

Reputation: 95031

You should be able to just do this:

<script src="jquery-1.5.0.min.js"></script>
<!-- plugins for 1.5.0 first... -->
<script src="jqueryui.min.js"></script>
<script src="jquery.hoverintent.min.js"></script>
<!-- then your code -->
<script src="main.js"></script>

where main.js contains:

var $jqueryold = $.noConflict(true);
(function($){
    // do stuff with $
    $(document).ready(function(){
        // ...
    });
})($jqueryold);

You could also skip the immediately executing function if all of your code goes inside a document ready:

var $jqueryold = $.noConflict(true);
$jqueryold(document).ready(function($){
    // do stuff with $
    $("#tabs").tabs();
});

However the ideal solution would be to update the old code to work with the new version of jQuery.

Upvotes: 5

Related Questions