
- 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 JavaScript libraries along with jQuery?
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.
You can try to run the following code to learn how to use multiple JavaScript libraries along with jQuery −
<html> <head> <!-- jQuery in the no-conflict mode. --> <script src="new.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> var $x = jQuery.noConflict(); // $x is now an alias to the jQuery function $x(document).ready(function() { $x( "div" ).hide(); }); $( "content" ).style.display = "none"; </script> </head> <body> <div></div> </body> </html>
- Related Questions & Answers
- How to select multiple elements with jQuery?
- How we can use Python CGI along with AJAX in Javascript?
- How to use multiple versions of jQuery on the same page?
- How to wrap multiple divs in one with jQuery?
- How to use JavaScript variables in jQuery selectors?
- Use existing authentication along with SAP BO
- Use workbench along with SAP Business One
- How to trigger the same function with jQuery multiple events?
- How to use JavaScript to set cookies for multiple pages?
- How to use multiple modules with Python import Statement?
- List of Best JavaScript libraries?
- How do we use .not() with jQuery selector?
- How to use the same JavaScript in multiple content pages?
- How to call jQuery function with JavaScript function?
- How to check if multiple elements with same class exist using jQuery?
Advertisements