I. Using JQUERY.NOCONFLICT () The function of this method is to let jquery give up ownership of $, return the control of $ to prototype.js, because Jquery.js is introduced later, so the last to have control is jquery. Its return value is jquery. When the method is called in code, we cannot use $ to invoke the JQuery method, at which time $ represents the $ defined in the Prototype.js library. as follows: Jquery.noconflict ();//The $ (' #msg ') can no longer be written here. Hide (), at which time $ represents the $ symbol defined in Prototype.js. Jquey ('#msg'). Hide (); Since then $ is no longer available on behalf of the $,jquery.js defined in Prototype.js, only the full name of jquery in Jquery.js is used. Two. Customizing the alias of jquery if you think that using the Jquery.noconflict () method in the first method, you can only use the jquery full name to be more troublesome, we could also redefine the alias for jquery. as follows:var$j =jquery.noconflict (); $j ('#msg'). Hide ();//$j here means jquery .Since then $ is no longer available on behalf of the $,jquey.js defined in Prototype.js, only $j can be used as an alias for jquery in Jquey.js. Three. Using a statement block, the $ defined in Jquery.js is still used in the statement block, as follows: Jquery.noconflict (); JQuery (document). Ready (function ($) {$ ('#msg'). Hide ();//The $ that is used in the method of the entire ready event at this time is the $ defined in Jquery.js.}), or use the following block of statements: (function ($) {...) $ ('#msg'). Hide ();//The $ that is defined in Jquery.js is now used in this statement block.}) (JQuery)
Modify the jquery default $