Skip to content

Instantly share code, notes, and snippets.

@fabriciofmsilva
Created February 17, 2018 12:29
Show Gist options
  • Save fabriciofmsilva/3f791bfc3d3633b73d951dbbd23afa17 to your computer and use it in GitHub Desktop.
Save fabriciofmsilva/3f791bfc3d3633b73d951dbbd23afa17 to your computer and use it in GitHub Desktop.
DOM Events

DOM Events

load

The load event is fired when a resource and its dependent resources have finished loading.

window.addEventListener("load", function(event) {
  console.log("All resources finished loading!");
});

DOMContentLoaded

The DOMContentLoaded event is fired when the initial HTML document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading.

document.addEventListener("DOMContentLoaded", function(event) {
  console.log("DOM fully loaded and parsed");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment