Friday, December 11, 2009

Using jQuery with Other Libraries

The jQuery library, and virtually all of its plugins are constrained within the jQuery namespace. As a general rule, "global" objects are stored inside the jQuery namespace as well, so you shouldn't get a clash between jQuery and any other library (like Prototype, MooTools, or YUI).

That said, there is one caveat: By default, jQuery uses "$" as a shortcut for "jQuery".

However, you can override that default by calling jQuery.noConflict() at any point after jQuery and the other library have both loaded.

When you use jQuery with other libraries, jQuery still is functional.
You can use jQuery directly

  // Use jQuery via jQuery(...)

or reassign jQuery to another shortcut

  var $j = jQuery;
  // Use jQuery via $j(...)

For more detail, please see

No comments: