jQuery - is it bad to have multiple $(document).ready(function() {});

后端 未结 5 813
孤街浪徒
孤街浪徒 2020-11-27 05:56

Is it bad to have multiple $(document).ready(function() {}); on your page? I have a website where I load different things at different times. I fire off those p

5条回答
  •  长情又很酷
    2020-11-27 06:48

    No it is fine to have as many as you want. A shorter, much more elegant way to do this is $(function(){}) though.

提交回复
热议问题