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

后端 未结 5 804
孤街浪徒
孤街浪徒 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:31

    If any of them throw an exception, it blocks the rest from running. This can be very difficult to debug with code "littered" across multiple source files (esp. 3rd party libraries).

提交回复
热议问题