What does (function( $ ){...})( jQuery ); do/mean?

jquery

Solution

It allows the author to use the $ function within the plugin without exposing it to the global scope - just keeps things a bit cleaner outside of the plugin itself.

I believe this is best practice for developing jQuery plugins - sure I saw it mentioned in the docs somewhere!

Problem

I am a bit new to reusable plugins for jquery. I have ran across this code several times and can't figure out exactly what is going on. ``` (function( $ ){ ... })( jQuery ); ``` Can any one enlighten me?

Original source