Many JavaScript libraries (like MooTools, which is loaded as part of the Joomla! 2.5 framework but phasing out in Joomla! 3) use $
as a function or variable name, just as jQuery does. In jQuery's case, $
is just an alias for jQuery
, so all functionality is available without using $
and can be replaced with jQuery
.
If you need to use another JavaScript library alongside jQuery (like MooTools, prototype, script.aculo.us...), return control of $
back to the other library with a call to noConflict()
.
Without the noConflict() addition
, scripts and declarations on a website page won't be able to determine what language is being used by that script, resulting in javascript errors since code created with the MooTools API, for instance, will not run properly with the jQuery API.
Find more information on the noConflict API and on how to avoid conflicts at the jQuery website.
Note More than 2 conflicting libraries on a same page is not recommended and may create erratic behaviors.