

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to use 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. jQuery.noConflict() method allows you to use multiple frameworks, while using jQuery. Other JavaScript frameworks include Ember, Angular, Backbone, etc.
The $ sign is used for jQuery, but what if other frameworks also use the same $ sign; this may create issues and conflict. To avoid this, jQuery issued the noConflict() method. The method releases the $ sign to be used my other JavaScript frameworks. Use jQuery with the name, jQuery.
With this, you can also use multiple versions of jQuery on the same page. You can try to run the following code to learn how to use multiple versions of jQuery on the same web page −
Example
<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>
- Related Questions & Answers
- How to trigger the same function with jQuery multiple events?
- How to avoid repeat reloading of HTML video on the same page?
- How to use the same JavaScript in multiple content pages?
- How to use multiple resource bundle in same JSP?
- How to disable a particular jQuery event on a page?
- While fetching the data as output, how can I use multiple conditions on same column?
- How to use multiple JavaScript libraries along with jQuery?
- How to bind multiple versions of a DB2 program into a package?
- How to use Google Fonts on your web page?
- How to Scroll to the top of the page using JavaScript/ jQuery?
- How to check if multiple elements with same class exist using jQuery?
- Manipulate two selects on page load with jQuery
- Drawing multiple legends on the same axes in Matplotlib
- How to get the index of an array element in older versions on MongoDB?
- MongoDB multiple OR conditions on same key?
Advertisements