$(document).ready() or $(function()) — Which to use?

后端 未结 4 565
后悔当初
后悔当初 2021-01-17 07:59

I saw there is an answered question about whether there is a difference between using $(document).ready(function(){}) and $(function(){}) (there is

4条回答
  •  無奈伤痛
    2021-01-17 08:39

    I believe the authors of jQuery recommend using $(document).ready(function(){...}); since it makes your code more transparent.

提交回复
热议问题