I kinda figured that it was an anonymous function, but the outer parens were kinda throwing me off.
Thanks for the info. On Jul 4, 2:38 pm, "Aaron Heimlich" <[EMAIL PROTECTED]> wrote: > On Fri, Jul 4, 2008 at 3:08 PM, benjam <[EMAIL PROTECTED]> wrote: > > What exactly does (function($){ ... })(jQuery) do? > > This > > function($){ ... } > > is an anonymous function. Because functions are first-class objects in > JavaScript, they can be treated just like any other object; which means that > you can immediately execute an anonymous function by doing this: > > function($){ ... }(jQuery) > > However, because of a quirk in JavaScript syntax, to be able to do this > properly, you need to put parentheses around the anonymous function, like > this: > > (function($){ ... })(jQuery) > > -- > Aaron Heimlich > Web Developer > [EMAIL PROTECTED]