Tutorial :jQuery: running 2 different jQuery versions on the same website?


can I run 2 different jQuery versions on the same website and avoid conflicts ?

please don't ask me why.. it is a long story.



Your html knows only know what you tell it, so if you have something like this in your HEAD section

<script src="<%= Url.Content("~/Scripts/jquery-1.4.2.min.js")%>" type="text/javascript"></script>  

instead of the below on a given page in your website there shouldn't be a problem.

<script src="<%= Url.Content("~/Scripts/jquery-1.3.2.min.js")%>" type="text/javascript"></script>  

However, I would not try to reference both versions from any given page as I would expect that to invite method name collisions...


well it should be possible, you will have to update your scripts though.

The idea is not all that difficult: include the least often used version first

then add this script

<script type="text/javascript">     window.jQueryOld = jQuery;  </script>  

then add the more often used version.

now you only have to update your scripts that use the old (or new version withchever it is) to use not the $ or jQuery variable, but the jQueryOld variable


Different versions you would get problems. define the includes in the head. You can use obviously different plugins/addons.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »