I would like to modify my jQuery to not use $
because using the $
sy开发者_如何转开发mbol would break other JavaScript libraries (eg. Prototype, Scripaculous). How can I use another variable name instead of the $
symbol?
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 don't need to set a variable.
Note: be sure to include jQuery after the other library, so it knows what to give $
back to.
I believe you're looking for noConflict mode
use this
<script type="text/javascript">
var jq=jQuery.noConflict();
jq(document).ready(function(){
// your code
});
</script>
精彩评论