// Your jQuery code here, using $ to refer to jQuery.
If you include jQuery before other libraries, you may use jQuery when you do some work with jQuery, but the $ will have the meaning defined in the other library. -->. WordPress Doesn’t Use the Latest jQuery Version. $ will be a reference to jQuery, not prototype.js. To Donate, see this list of organizations to support from Reclaim the Block. . This is most frequently used in the case where you still want the benefits of really concise jQuery code, but don't want to cause conflicts with other libraries. 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.js, MooTools, or YUI). This article does not cite any sources. Here's a recap of ways you can reference the jQuery function when the presence of another library creates a conflict over the use of the $ variable: The jQuery.noConflict() method returns a reference to the jQuery function, so you can capture it in whatever variable you'd like: You can continue to use the standard $ by wrapping your code in an immediately invoked function expression; this is also a standard pattern for jQuery plugin authoring, where the author cannot know whether another library will have taken over the $. When you put jQuery into no-conflict mode, you have the option of assigning a new variable name to replace the $ alias. There are lots of other JavaScript libraries out there, but jQuery is probably the most popular, and also the most extendable. mainDiv below is a DOM element, not a jQuery object. Web hosting by Digital Ocean | CDN by StackPath, . Note that if you use this technique, you will not be able to use prototype.js methods inside the immediately invoked function. The new alias can be named anything you'd like: jq, $J, awesomeQuery, etc. That said, there is one caveat: by default, jQuery uses $ as a shortcut for jQuery. jQuery License Created in 2006 by John Resig, the jQuery library is now the most popular JavaScript library on the web.