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]

Reply via email to