DOM - Ready event (Readiness|readyState)


A document is in a ready state when the DOM has been built.

Any work that tries to interact with the DOM should wait for the DOM to be ready.


For an HTML page, in a browser, all images are not finished downloading, including banner ads.


The readyNess can be read in the readyState property of the document


The document.readyState property returns:

  • loading while the Document is loading, (ie if the document is associated with an HTML parser, an XML parser, or an XSLT processor)
  • interactive once it is finished parsing but still loading sub-resources,
  • and complete once it has loaded.

The readystatechange event fires on the Document object when this value changes.

Timeline Event Reference

Run code at event

Native Javascript

In Native Javascript, dom ready is known as DomContentLoaded.

window.addEventListener('DOMContentLoaded', function () {
  console.log("It's ready!")


To run code as soon as the document is ready to be manipulated in Javascript - JQuery with the Ready event

$( document ).ready(function() {
    // Your code here.
    console.log("Ready !")

Discover More
Browser - DOMContentLoaded event (page load)

DomContentLoaded is a page load event that signals that the parser has finished the construction of the DOM. The resources at the left or touching the blue line are blocking the construction of the DOM....
Browser - Page loading

Page loading is a status of the timeline of a page load. When a page is loaded, it means that the browser: has received a HTTP response from an request and has parsed the content (during the parse...
DOM - Document Loaded - onload event

The load event is an event that is fired / emitted on: an HTML element that fetch resources on the browser window when the page has finish loading. This event is a timing page load event To...
Headless browser - WebDriver / ChromeDriver (automated testing - W3C WebDriver API )

A WebDriver is a application: that control / drive real browsers. via function that are available via the the WebDriver API Each browser is backed by a specific WebDriver implementation, called...
Page Loading Key Moment
Web - Timeline of a page load (Page Speed|Page Latency)

Page load is the latency performance metrics that cumulates: TCP latency (ie how fast, the network will receive the HTTP request and send back the HTTP response ) HTTP latency (ie how fast the web...

Share this page:
Follow us:
Task Runner