I still get Document ready function fire. Could you please let me know the reason why I am getting Document.ready event before the execution of Window load event.
$(window).on("load", function () { var height = $("#img1").height();
Why developers mostly use $(document).ready event over windows load event? Even though the windows load event has both DOM and all other contents on the page are loaded rather document ready has only waits for DOM to be loaded.
I still get Document ready function fire. Could you please let me know the reason why I am getting Document.ready event before the execution of Window load event.
ReplyDelete$(window).on("load", function () {
var height = $("#img1").height();
$("h1").html("Windows Load Height:" + height);
});
$(document).ready(function () {
var height = $("#img1").height();
$("h1").html("Document Load: Height:" + height);
})
Why developers mostly use $(document).ready event over windows load event? Even though the windows load event has both DOM and all other contents on the page are loaded rather document ready has only waits for DOM to be loaded.
ReplyDelete