I have a self invoking function with a window.onload in it. But the window.onload is not really called after windows is loaded. Often, myBtn returns null as the chrome-debugger says
"Uncaught TypeError: Cannot set property 'onclick' of null".
Why is that so? How can I solve that?
Using jquery and this script returns the same error:
I have put the script into the head-element.
I know, that document.ready will run immediately after DOM is built.
Self-invoking functions will run instantly - but window-onload should, normally should run after dom is built.
But this is not the case. Why?