JavaScriptMedium
Difference between document load event and document DOMContentLoaded event?
By FrontendPro Editorial Team Updated 8/8/2026
#JavaScript
Answer
The DOMContentLoaded event fires when the initial HTML document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading. The load event, on the other hand, fires when the entire page, including all dependent resources such as stylesheets and images, has finished loading.
javascript
document.addEventListener("DOMContentLoaded", function () {
console.log("DOM fully loaded and parsed");
});
window.addEventListener("load", function () {
console.log("Page fully loaded");
});
