I want to fire and event when the DOM has completely loaded. I checked out document.readyState
but it's not an event. I want to fire it when the readyState
is complete. How do I do that?
Some easy googling point me to this code:
// alternative to DOMContentLoaded
document.onreadystatechange = function () {
if (document.readyState == "complete") {
initApplication();
}
}
And to this link
Handle the window.load
event.
This will only fire when all external resources (including images) have loaded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With