Can you have multiple $(document).ready(function(){ … }); sections?

前端 未结 11 1224
庸人自扰
庸人自扰 2020-11-22 13:21

If I have a lot of functions on startup do they all have to be under one single:

$(document).ready(function() {

or can I have multiple such

11条回答
  •  花落未央
    2020-11-22 13:50

    Yes it is possible but you can better use a div #mydiv and use both

    $(document).ready(function(){});
    
    //and
    
    $("#mydiv").ready(function(){});
    

提交回复
热议问题