<pclass="arguement"><strong>removeAll</strong>A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself).</p>
</li></ul>
<divclass="longdesc">
<p>Many JavaScript libraries use <code> $</code> as a function or variable name, just as jQuery does. In jQuery's case, <code> $</code> is just an alias for <code>jQuery</code>, so all functionality is available without using <code> $</code>. If we need to use another JavaScript library alongside jQuery, we can return control of <code> $</code> back to the other library with a call to <code>$.noConflict()</code>:</p>
// Code that uses other library's $ can follow here.
</script>
</pre>
<p>This technique is especially effective in conjunction with the .ready() method's ability to alias the jQuery object, as within callback passed to .ready() we can use $ if we wish without fear of conflicts later:</p>
// Code that uses other library's $ can follow here.
</script>
</pre>
<p>If necessary, we can free up the <code> jQuery</code> name as well by passing <code>true</code> as an argument to the method. This is rarely necessary, and if we must do this (for example, if we need to use multiple versions of the <code>jQuery</code> library on the same page), we need to consider that most plug-ins rely on the presence of the jQuery variable and may not operate correctly in this situation.</p>
</div>
<h3>Examples:</h3>
<divid="entry-examples"class="entry-examples">
<divid="example-0">
<h4>Example: <spanclass="desc">Maps the original object that was referenced by $ back to $.</span>
</h4>
<pre><codeclass="example">jQuery.noConflict();
// Do something with jQuery
jQuery("div p").hide();
// Do something with another library's $()
$("content").style.display = 'none';</code></pre>
</div>
<divid="example-1">
<h4>Example: <spanclass="desc">Reverts the $ alias and then creates and executes a function to provide the $ as a jQuery alias inside the functions scope. Inside the function the original $ object is not available. This works well for most plugins that don't rely on any other library.
</span>
</h4>
<pre><codeclass="example">jQuery.noConflict();
(function($) {
$(function() {
// more code using $ as alias to jQuery
});
})(jQuery);
// other code using $ as an alias to the other library</code></pre>
</div>
<divid="example-2">
<h4>Example: <spanclass="desc">You can chain the jQuery.noConflict() with the shorthand ready for a compact code.