Cannot set property InnerHTML of null [duplicate]
You are almost certainly running your code before the DOM is constructed. Try running your code in a window.onload handler function (but see note below): Another popular cross-browser solution is to put your <script> block just before the closing </body> tag. This could be the best solution for you, depending on your needs: Note that … Read more