Why “$().ready(handler)” is not recommended?

后端 未结 6 1551
鱼传尺愫
鱼传尺愫 2020-11-27 13:30

From the jQuery API docs site for ready

All three of the following syntaxes are equivalent:

  • $(document).ready(handle
6条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 14:25

    I think this is really more for readability than anything else.

    This one isn't as expressive

    $().ready(handler);
    

    as

    $(document).ready(handler)
    

    Perhaps they are trying to promote some form of idiomatic jQuery.

提交回复
热议问题