Namespaces and jQuery

June 18, 2013

Namespaces in jQuery getting you down?

Chuck taught me a great trick today — how to avoid namespace conflicts in jQuery:

(function($){
...
})(jQuery);

This function is being passed jQuery as an argument, and is assigning it the local variable $ — allowing you to use the $ and reference the jQuery library.

Awesome.


Katie Leonard

Mostly Katie explaining things to herself.

© 2025