Reputation: 524
$();
I think it's from jQuery. I'm used to using $(document).ready(function(){});
from jQuery but someone used $(function(){});
and I'm confused how you could have an anonymous function within the $();
.
Upvotes: 1
Views: 75
Reputation: 185671
According to this page, wrapping a callback in $()
executes the callback when the page is ready (similar to using $(document).ready(callback)
, or (I believe) immediately if the document is already ready.
Upvotes: 0
Reputation: 522016
jQuery(function () { })
, or $(function () { })
, is shorthand for jQuery(document).ready(function () { })
. See http://api.jquery.com/jQuery/#jQuery3.
Upvotes: 6