How to use keyword instead of $ in jquery?

I would like to change my jQuery so as not to use $ , because using the $ character will break other JavaScript libraries (e.g. Prototype, Scripaculous). How to use a different variable name instead of the $ character?

+4
source share
3 answers

Use jQuery.noConflict() for compatibility with other libraries, for example:

 var $j = jQuery.noConflict(); 

Then use $j for jQuery instead of $ ... or just use jQuery , in which case you do not need to set a variable.

Note. Be sure to include jQuery after another library so that it knows what to return $ back.

+16
source

I believe you are looking for noConflict mode

+2
source

use this

 <script type="text/javascript"> var jq=jQuery.noConflict(); jq(document).ready(function(){ // your code }); </script> 
0
source

All Articles