أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
$(document).ready() executes when HTML-Document is loaded and DOM is ready
$(windows).load() executes when complete page is fully loaded, including all frames, objects and images
The ready event occurs after the HTML document has been loaded, while the onload event occurs later,
when all content (e.g. images) also has been loaded.
The onload event is a standard event in the DOM, while the ready event is specific to jQuery. The purpose of the ready event is that it should occur as early as possible after the document has loaded, so that code that adds functionality to the elements in the page doesn't have to wait for all content to load.
$(windos).load() will wait to complete all http request including rending of images/videos etc where as $(docment).ready() will wait till the document/html page render on in other word when dom is ready.
The difference are:$(document).ready(function() { is jQuery event that is fired when DOM is loaded, so it’s fired when the document structure is ready.$(window).load() event is fired after whole content is loaded.