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 −

<!-- jQuery in the no-conflict mode. -->
<script src="new.js"></script>
<script src=""></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";

Updated on: 12-Jun-2020


Kickstart Your Career

Get certified by completing the course

Get Started