0

Possible Duplicate:
What does (function($) {})(jQuery); mean?
For the function (function($){})(), I've seen it with the word jQuery in it, why is that?

I've seen this used in many places, and I understand that some code ill not work without it... but I have no idea what it does: what is the purpose of this wrapper?

(function($){  

     ...

})(jQuery);

An explanation and/or direction to some good resources would be greatly appreciated!

Community
  • 1
  • 1
christina
  • 621
  • 2
  • 11
  • 17

1 Answers1

1

It defines a scope for what's inside the function body, keeping it out of the global namespace, while defining $ as an alias for jQuery.

Grumdrig
  • 14,990
  • 11
  • 53
  • 68