How to use different version of JQuery on a JS file?

I have a Cisco JS library designed to work using JQuery 1.4.2 and I'm using latest 2.X version of JQuery on the UI page I'm developing.

Cisco Library

I'm using Jabberwerx.js file from the above library link.

The library works fine if the JQuery loaded is of 1.4 but fails to work with later versions of JQuery. If I use old version of Jquery my UI based on bootstrap doesn't work. I tried to use noConflict() but then I can not edit the entire library which is very huge. There are lots of webservice calls and functions on the library so upgrading it is very painstaking.

Is it possible to use a particular version of JQuery on this JS file and the rest of the application can use the latest version of JQuery?

The library has this code on it. Can we change this to make it work using old version of JQ.

{   var jQuery=function(selector,context)
        return new jQuery.fn.init(selector,context);

I'm not looking at using different versions of JQuery on the same page but I'm trying to limit the usage of one version of JQuery to one of the JS files.


When you use different version of jquery then your code conflicts. So there may appear obvious errors.

To fix it, you need to use $.noConflict() passing a boolean parameter true.

//removes jquery itself and allows you to work with different version of jquery


<script src="jquery-version-1.0"></script>
<script>//code for v-1</script>
<script>jQuery.noConflict(true);//remove jquery</script>
<script src="jquery-version-2.0"></script><!--use another version-->
<script>//code for v-2</script>

In addition to what Bhojendra Nepal's answer, You can also check the version of jQuery through the following Code :

var jq_version = $().jquery;
    /* gives the version number like 1.7.1. So may be you can write an if condition around the version number. For e.g :*/
    if(jq_version == '1.7.1'){
        //do something for ver 1.7.1

There are even more ways to Check the version of jQuery. But I'm not sure if that would help much with the CISCO library you are using.

Need Your Help

NLTK - WordNet: list of long words

python nlp nltk wordnet

I would like to find words in WordNet that are at least 18 character long. I tried the following code:

Conversion from excel to .CSV format

excel-2010 export-to-csv

I have some data in excel format and it contains Tamil Text as well as English text.