Skip to content

Instantly share code, notes, and snippets.

@getify
Created November 16, 2010 15:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save getify/701970 to your computer and use it in GitHub Desktop.
Save getify/701970 to your computer and use it in GitHub Desktop.
how to use jQuery.noConflict() to manage multiple versions of jQuery on same page
<html>
<head>
<script src="jquery-1.3.3"></script>
<script>var $jq133 = jQuery.noConflict(true);</script>
<!-- other stuff -->
<script src="jquery-1.4"></script>
<script>var $jq14 = jQuery.noConflict(true);</script>
<!-- other stuff -->
<script src="jquery-1.4.3"></script>
<script>var $jq143 = jQuery.noConflict(true);</script>
<!-- other stuff -->
<script>
$jq14; // ...
$jq143; // ...
$jq133; // ...
</script>
</head>
<body></body>
</html>
@getify
Copy link
Author

getify commented Jul 7, 2020

@santosh-k1 see the jquery docs here. in the particular page (that you control):

<script src="latest-jquery.js"></script>
<script>
   var $jqLatest = $.noConflict(true);
 </script>

Now, the jQuery and $ versions should all be the older one from the master page, and the current page should be able to use the latest jQuery from whatever variable name you chose like $jqLatest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment