(I\'ll show the pure javascript below) I\'ve got these two lines of code that are, in my mind, doing the exact same thing but one of them reports an error. This appears in a fi
. This way all DOM elements are loaded before any JavaScript is executed.
Try to wrap all inits that are dependent on DOM elements in the window
's load
event inside the script files themselves in case you cannot or don't want to move them to the bottom:
window.addEventListener('load', function() {
/// init the resource here...
}, false);