jQuery(ready, load) VS Javascript(onload)
The order of execution
1. DOM element Loading
2. DOM element Load end, jQuery ready ( 이미지가 로딩되지 않아도 됨)
2-1. Body onload
3. Document Load end, jQuery load ( 이미지등 모든 내용이 완료된 시점 )
sample code
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<script src="./Scripts/jquery-1.9.1.js"></script>
</head>
<body onload="javascipt:alert('body tag onload(2-1)')">
jQuery(ready, load) VS Javascript(onload)
<script>
$(window).load(function(){
alert('jquery load event(3)');
});
$(window).ready(function(){
alert('jquery ready event(2)');
});
alert('script alert event(1)');
</script>
</body>
</html>
|