The solution of jquery and other JS (Prototype) library conflict is very simple, is the use of jquery jquery.noconflict () function, the following small series for you to introduce, the need for friends can refer to the
First, after running this function, you can restore the use of alias $, in the scope of this function will still be $ as the alias of JQuery to use.
jQuery Code:
Copy Code code as follows:
Jquery.noconflict ();
(function ($) {
$ (function () {
Use $ as a jQuery alias code
});
}) (JQuery);
Code that uses $ as an alias based on other libraries
Two, after running this function, you can create a new jquery alias to replace the original jquery alias $ to use.
jQuery Code:
Copy Code code as follows:
var j = jquery.noconflict ();
Code that uses the new alias JQuery
J ("Div p"). Hide ();
Code that uses $ as an alias based on other libraries
$ ("content"). Style.display = ' None ';
Note: This function must be used after you import the JQuery file and before importing another library that is causing the conflict.