Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 21
    This answer is precisely opposite of what was asked in the question. Commented Dec 25, 2017 at 19:25
  • 3
    Indeed the DOMContentLoaded event is triggered when all DOM contents have been loaded, before it has loaded all its dependencies. Since users in the thread of answers referenced $.ready I thought it made a good contribution. Btw. I'd use the addEventListener-method also for the load event though, as it allows you to have multiple callbacks: window.addEventListener("load", function(event){ // your code here }); Commented Jan 2, 2018 at 18:08
  • my DOMContentLoaded event is not fired Commented Jul 10, 2022 at 12:48
  • 1
    @Dee it should, it is quite an old event supported by all major browsers for years; perhaps you have some slow loading resources on your page. If you need help sorting out your particular problem, please ask a new question. Commented Jul 12, 2022 at 11:12