Site icon Puneet Sharma – Freelance Web Developer

How to use multiple versions of jQuery on the same page?

Multiple versions of jQuery on the same page

Yes, you can use multiple versions of jQuery on the same page. To avoid any kind of conflict, use the jQuery.noConflict() method.


HTML

<html>
<head>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
   var $x = jQuery.noConflict();
   alert("Version: "+$x.fn.jquery);
</script> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
   var $y = jQuery.noConflict();
   alert("Version: "+$y.fn.jquery);
</script> 
</head>

<body>
</body>
</html>

Exit mobile version