Is the following shorthand for $(document).ready
?
(function($){
//some code
})(jQuery);
I see this pattern used a lot, but I'm unable to find any reference to it. If it is shorthand for $(document).ready()
, is there any particular reason it might not work? In my tests it seems to always fire before the ready event.
var somevar;
) will not change the contents of variables of the same name outside of the function