Tuesday, January 20, 2015

Multiple versions of jQuery on the same page?

Multiple versions of jQuery on the same page?

Is it possible to handle conflicts between 2 versions of jQuery loaded in the same page? Assume that these lines of code:

<script type="text/javascript" src="jquery-1.1.3.js"></script>              
<script type="text/javascript" src="jquery-1.4.2.js"></script>              


use $.noConflict(true);

<!-- load jQuery 1.1.3 -->                                                       
<script type="text/javascript" src="http://example.com/jquery-1.1.3.js"></script>
<script type="text/javascript">                                                  
var jQuery_1_1_3 = $.noConflict(true);                                           

<!-- load jQuery 1.3.2 -->                                                       
<script type="text/javascript" src="http://example.com/jquery-1.3.2.js"></script>
<script type="text/javascript">                                                  
var jQuery_1_3_2 = $.noConflict(true);                                           

Then, instead of $('#selector').function();,                                     
 you'd do jQuery_1_3_2('#selector').function(); or jQuery_1_1_3('#selector').function();.

enjoy :)                                                                                

1 comment:

  1. My friend Suggest me this blog and I can say this is the best blog to get the basic knowledge.Thank you so much for this Selenium Training in Chennai


Related Posts Plugin for WordPress, Blogger...