Shivangi Rajde
$(document).ready() v/s $(window).load()

What is the difference between $(document).ready() and $(window).load() functions in jQuery? What are the correct scenarios to use each function?

By Shivangi Rajde in JQuery on Jun 14 2020
  • Pranam Bhat
    May, 2021 25

    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.window.onload: A normal JavaScript event.document.ready: A specific jQuery event when the entire HTML has been loaded.

    • 2


Most Popular Job Functions


MOST LIKED QUESTIONS