//자바스크립트 문서로딩 완료 실행 되는 순서(js 실행순서)

 

 

document.addEventListener('readystatechange', (event=> {

    console.log('readystatechange-1');//1 - 주의 다중 실행 가능

});



document.addEventListener('DOMContentLoaded', (event=> {

    console.log('DOMContentLoaded-2');//2

});

 

//----------------------------------

$(function(){

    console.log('jq - function');//3

});

 

$document ).ready(function() {

    console.log('jq - ready');//3

});



//----------------------------------

window.onload = (event=> {

    console.log('window.onload'event);//5

};

 

window.addEventListener('load', (event=> {

    console.log('window.addEventListener load');//5

});




Posted by 코덴스

댓글을 달아 주세요