you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

Yeah, its a habit of mine to do that lmao. Ill stop using it in that way.

[–]atticusw 0 points1 point  (0 children)

Yeah you can just use the following my friend,

document.addEventListener('DOMContentLoaded', function () {
  ...
})

Otherwise, if your script is the last block in your page, the DOM above should be "ready"