What does the following code structure do?
(function($){
// Some code
})(jQuery);
I've encountered this structure here.
Edit
As a reference to myself:
jQuery is the same as $ in your jQuery scope. Other libraries than jQuery often have the character $ defined as well. Someone might want to use another js library next to jQuery(e.g. Mootools). In order to let them work together you should undefine or redefine $.
The following line undefines $ in jQuery:
jQuery.noConflict();
The following line redefines $ as $jq in jQuery:
var $js = jQuery.noConflict();
When you use the code structure (function($){ // Some code })(jQuery); you are guaranteeing the jQuery code //Some code to work even is someone called that code in a scope where $ is undefined.
Also see Tats_innit's answer here.