How does jQuery no conflict mode work?

by admin, November 4, 2014

jQuery no conflict mode is for situations where you have several javascript libraries included in your page and each of them defines a global variable named $. In this case, $.noConflict() changes the value of $ value back to the old value provided by a different library and you have to use jQuery functions by using the variable jQuery in your code instead of $.

 

<script src=”other_lib.js”></script>

<script src=”jquery.js”></script>

<script>

$.noConflict();

jQuery( document ).ready(function( $ ) {

// Code that uses jQuery’s $ can follow here.

});

// Code that uses other library’s $ can follow here.

</script>

 

jQuery-Error