As stated in this thread: window.onload vs $(document).ready(). The window.onload
should occur later than the $(document).ready()
but in this simple code the log would show that the onload
event is executed before the ready event? What I'm I missing here?
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
</head>
<body>
<h1>A Simple Site</h1>
<script>
$(document).ready(function() {
console.log("ready event fired");
})
window.onload = function() {
console.log("onload event fired");
}
</script>
</body>
</html>