top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to handle if in a webpage there are two different version of jQuery library present?

+1 vote
304 views
How to handle if in a webpage there are two different version of jQuery library present?
posted Jul 3, 2015 by Manikandan J

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes

You can have as many different jQuery versions on your page as you want.

Use jQuery.noConflict():

I am trying to explain it by an example:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
<script>
    var $i = jQuery.noConflict();
    alert($i.fn.jquery);
</script> 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
    var $j = jQuery.noConflict();
    alert($j.fn.jquery);
</script> 

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>
    var $k = jQuery.noConflict();
    alert($k.fn.jquery);
</script> 
answer Jul 4, 2015 by Amit Kumar Pandey
...