Get Major Training|Project Training|Live Project|Industrial Training On Android| I-Phone | Java | J2SE | J2EE | C#.Net | ASP.Net| PHP | PHP with Wordpress | Joomla | Majento Contact us

Friday

How to run Multiple Jquery on a same page

Do you ever experience Jquery not working when ever you use two or multiple j query versions simultaneously 

Look at the Problem

The problem is that some customers may already have an older version of jQuery installed. While this may work if it's at least a fairly recent version, new code does rely on some recently introduced functionality in the jQuery library, so there are bound to be instances when a customer's jQuery version is just too old. We can't require that they upgrade to the latest version of jQuery.
Is there any way to load a newer version of jQuery to use only within the context of our code, that will not interfere with, or affect, any code on the customer's page? Ideally, maybe we could check for the presence of jQuery, detect the version, and if it's too old, then somehow load the most recent version just to use for our code.

here is the solution

<!-- 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);
</script>

<!-- 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);
</script>


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

Author: Vikas Agrawal
Vikas Agrawal is a CEO and Founder Of Vinayak Informatics Systems. Read More →

You Like It, Please Share This Article Using...



No comments:

Post a Comment

Please leave your comments and we will be reply you back ASAP
vikas agrawal