开发者

What does this mean $();?

$();

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 $();.


jQuery(function () { }), or $(function () { }), is shorthand for jQuery(document).ready(function () { }). See http://api.jquery.com/jQuery/#jQuery3.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜