How does jQuery achieve making $ an alias for the jQuery function?
<p>I’m having a little trouble wrapping my head around the $ sign being an alias for the jQuery function, particularly in a plugin. Can you explain how jQuery achieves this aliasing: how does it define '$' to be an alias for the jQuery function? That's the first question.</p>

<p>Secondly, can you explain how/why the following code works to map '$' to the jQuery function in a plugin's definition and why if you don't do this, your plugin could collide with other libraries that might use the dollar sign?</p>

<pre><code>(function( $ ){
    $.fn.myPlugin = function() {
        // Do your awesome plugin stuff here
    };
})(jQuery);
</code></pre>

<p>Thanks for taking the time to answer my question.</p>
