getElementById returns null? [closed]
Also be careful how you execute the js on the page. For example if you do something like this: (function(window, document, undefined){ var foo = document.getElementById(“foo”); console.log(foo); })(window, document, undefined); This will return null because you’d be calling the document before it was loaded. Better option.. (function(window, document, undefined){ // code that should be taken … Read more