开发者

What does this mean $();?

开发者 https://www.devze.com 2023-02-14 21:47 出处:网络
$(); 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 fu
$();

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

精彩评论

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