The following code:
jQuery.noConflict();
jQuery(document).ready(function(){
//Your Code....
});
jQuery.noConflict( ) Detailed introduction:
Overview
Run this function to transfer control of the variable $ to the first library to implement it. This helps ensure that jQuery does not conflict with other libraries' $ objects. After running this function, you can only access jQuery objects using jQuery variables. For example, where $("div p") is used, it must be replaced by jQuery("div p").
Note: This function must be used after you import the jQuery file, and before importing another library that causes conflicts. Of course it should also be done before other conflicting libraries are used, unless jQuery is the last one imported.
Description:
Map the object referenced by $ back to the original object.
jQuery code:
jQuery.noConflict();
// Use jQuery
jQuery("div p").hide();
// Use $() from other libraries
$("content").style.display = 'none ';
Description:
Restore the use of the alias $, and then create and execute a function that still uses $ as an alias for jQuery in the scope of this function. In this function, the original $ object is invalid. This function works well for most plugins that don't rely on other libraries.
jQuery code:
jQuery.noConflict();
(function($) {
$(function() {
// Code using $ as jQuery alias
});
})(jQuery);
// Code for other libraries that use $ as an alias
Description:
Creates a new alias for using jQuery objects in subsequent libraries.
jQuery code:
var j = jQuery.noConflict ();
// Code based on jQuery
j("div p").hide();
// Code based on $() from other libraries
$("content"). style.display = 'none';