How to use multiple JQuery version in a application

JQuery is a best javascript framework in current development environment. Some times we have to use multiple plugin based on our application requirements, these plugin doesn’t support latest Jquery or any version which we are using in our application.

Thats why our application get crashed due to multiple versions, we are not able to identify actual cause. Multiple version also break other plugin because they are not supported the current one.

To resolve this conflict can we try jQuery.noConflict(); method. This will solve this issue.

The below example shows how to use it:

<script type="text/javascript" src="js/jquery-1.5.js"></script>
<script type="text/javascript">
var jQuery15 = $.noConflict(true);
</script>

<script type="text/javascript" src="js/jquery-1.7.1.js"></script>
<script type="text/javascript">
var jQuery171 = $.noConflict(true);
</script>

After that where we are using $(“#myid”).css()……

Replace it with jQuery15(“#myid”).css()…… or jQuery171 (“#myid”).css()………..

i.e. replace $ with Jquery version variable.

This will solve your Jquery Conflict.


Posted

in

by

Tags: