Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for Why declare inside of $(function () { ... })?

Current License: CC BY-SA 3.0

6 events
when toggle format what by license comment
Apr 22, 2012 at 8:52 vote accept Community Bot
Apr 22, 2012 at 6:51 comment added Wouter J I suggest to use something like jQuery(function($) { ... }); because you build a automatic noConflict system and you always can use the normal $ in the code inside this function.
Apr 22, 2012 at 6:04 comment added jfriend00 This is precisely why I'd rather see people use $(document).ready(function() {...}) instead of $(function() { ... }); because the former is so much more obvious what it does.
Apr 22, 2012 at 5:50 comment added dtbarne True, but you don't need jQuery for that. A (function() { ... })() used properly would do.
Apr 22, 2012 at 5:47 comment added Matt Ball It also avoids polluting the global namespace.
Apr 22, 2012 at 5:46 history answered dtbarne CC BY-SA 3.0

AltStyle によって変換されたページ (->オリジナル) /