Skip to main content

Posts

Showing posts with the label document ready vs window load

document ready vs. window load

What is main difference between the $(document).ready () and window.onload()? The main differences are the $(document).ready() event called when your HTML document is loaded and DOM is ready and it's don't wait for your content and images etc. fully loaded but  window.onload() (<body onload="func();">) event is  wait for your content and images etc. fully loaded. The $(document).ready() function is called only one time when your page is loading not for partial page rendering in that case you need to use pageLoad() function. Document Ready function:- We can call more than one document.ready() function in single page. The  document.ready()  function is called when  DOM  is not fully loaded that means rest of images, css or other 3rd party reference on page. It will not wait for the images, css or other 3rd party to get loaded. Body Onload function:- The body.onload() function, we can have only one body.onload...