Another popular JavaScript framework is jQuery. The jQuery framework has functionality that is similar to MooTools, but uses a different style of code. Although they are separate projects, extra care must be taken when using them together. By default, both frameworks automatically reserve $
to have a special meaning in JavaScript. If you do not take steps to avoid this behavior, one library will overwrite the other's assignments and the scripts will fail.
Fortunately, jQuery has strategies that you can use to avoid this conflict. There are three things that you must do to keep jQuery and MooTools out of each other's way:
Load jQuery only after MooTools has been loaded
Call
jQuery.noConflict()
to return control of$
to MooToolsReference jQuery directly in your scripts instead of using
$
Before avoiding conflicts with MooTools, start by writing some jQuery without MooTools being present. First, go to jquery.com, download the latest version of jQuery...