The (rather long) subject line says it all. This idiom is widely used to avoid having to assume $ == jQuery and at the same time avoiding writing jQuery all the time. (function($){ ... })(jQuery)
I'm wondering if instead this would work. (function(){ var $ = jQuery; ... })() The reason I ask is that I'd like to shorthand several things in this way. The first method requires me to go down to the end of a (long) function body to find out what, say '_' and 'C' really mean (private and Constants, say), whereas the second method tells me up front. I know enough JavaScript to think of this alternative approach, but not enough to be sure that it will work in all relevant circumstances. -- Jonathan