2

Trying to load these 3 with no conflict. But, there still is a conflict.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

<script>
var $j = jQuery.noConflict();
$j(function() {
$j( "#selector" ).click(function() {
alert("hello");
});
});
</script> 
juan beras
  • 51
  • 1
  • 7

2 Answers2

2

Solution:

Use jQuery.noConflict();

<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> 

DEMO

martynas
  • 12,120
  • 3
  • 55
  • 60
  • @juanberas fixed it and included a jsFiddle link. – martynas Feb 12 '14 at 18:17
  • Hmmm..I tried that and it didn't do the trick. I have colorbox, fade slideshow on same page plus one more jQuery version. But the colorbox pop up when you click Contact won't load. Link: http://shop.earartbyjaniyah.com/ – juan beras Feb 12 '14 at 18:41
  • Could you please post the relevant code here? Just edit your questions so other community members can see it as well. – martynas Feb 12 '14 at 18:50
1

According to the previous question you can use multiple jQuery at a time. See this 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> 

Here is a jsfiddle DEMO.

Ananda G
  • 2,389
  • 23
  • 39