I’m executing an external script, using a
Now since the script executes before the page has loaded, I can’t access the
These solutions will work:
As mentioned in comments use defer:
<script src="deferMe.js" defer></script>
document.onload = function ...
window.onload = function ...