Load event not working while used with a selector element

Below is my <script> tag:



why is onload not working?

And this is not just with html tag but with basically any selector.

19 thoughts on “Load event not working while used with a selector element”

  1. Most elements don’t load content (the obvious exceptions being <iframe> and <img>) so load events don’t fire on them.

    If you want to capture the page’s load event, then you shouldn’t bind to any element:

    addEventListener("load", yourEventHandlerFunction);
  2. Hey there! I know this is somewhat off topic
    but I was wondering which blog platform are you using for this site?
    I’m getting fed up of WordPress because I’ve had problems with hackers and I’m looking at alternatives for another platform.

    I would be fantastic if you could point me in the direction of a good platform.


Leave a Comment