jQuery - What are differences between $(document).ready and $(window).load?

前端 未结 8 2306
旧巷少年郎
旧巷少年郎 2020-11-22 02:45

What are differences between

$(document).ready(function(){
 //my code here
});

and

$(window).load(function(){
  //my code h         


        
8条回答
  •  Happy的楠姐
    2020-11-22 03:26

    $(document).ready(function(e) { 
        // executes when HTML-Document is loaded and DOM is ready  
        console.log("page is loading now"); 
    });
    
    $(document).load(function(e) { 
        //when html page complete loaded
        console.log("completely loaded"); 
    });
    

提交回复
热议问题