In jQuery's case, $ is just an alias for jQuery, so all functionality is available
can return control of $ back to the other library with a call to noConflict() in
jQuery. In a similar way we can use two different jQuery releases and also prevent
Below are four examples of using jQuery noConflict(). The scripts on the left side
of the page are all the same. On the right side are the modified scripts with additions/substitutions
shown in red.
Your scripts will be different to these examples, but the principal is the same.
You may need to insert lines as shown below, and as on three examples change every
$ sign to a variable. Only change jQuery scripts to noConflict. Leave Mootools and
js.prototype scripts as they are. Make sure your scripts function individually before
changing anything, and ask if you need help.
This shows a variable $j being assigned within the script, and all the $ signs in
the script are replaced by $j
This shows the $ being replaced by jQuery which is also assigned within the script.
This shows a variable jq152 being assigned outside the script, and all the $ signs
in the script are replaced by jq152. Useful if you are using two jquery libraries.
The listing needs to be exactly as shown below. i.e call the first library 1.5.2,
list the no conflict script, list the script. Next list the call for the second library,
list the no conflict script, list the script. If the second library used jquery 1.7.1
you could use the variable jq171 which down the line would help you identify which
script is used with which library.
This assigns the noConflict statement outside of the script and the $ in the script
is not changed. This works well with a number of plugins.