I have a page that has jQuery 1.6.2. In some cases I load an app that requires jQuery 1.4.2. I need to force the app to use the 1.4.2 version. I am not able to change the selectors ($ to $$).
Is there a way to force the use of jQuery 1.4.2?
for instance onclick of an element I load the app. Right before I load the app can I use getScript to pull the old version of jQuery?
Yes you can, check out this great article at http://blog.nemikor.com/2009/10/03/using-multiple-versions-of-jquery/.
Something like this:
<!-- load jQuery 1.6.2 -->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.js"></script>
<!-- revert global jQuery and $ variables and store jQuery in a new variable -->
<script type="text/javascript">
var jQuery_1_6_2 = $.noConflict(true);
(function($){
/* app code that uses jQuery 1.6.2 */
}(jQuery_1_6_2))
</script>
<!-- load jQuery 1.4.2 -->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.js"></script>
<!-- revert global jQuery and $ variables and store jQuery in a new variable -->
<script type="text/javascript">
var jQuery_1_4_2 = $.noConflict(true);
(function($){
/* app code that uses jQuery 1.4.2 */
}(jQuery_1_4_2))
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With