Where possible put your script element at the bottom of the body, after the html, this way when the browser parces the code from top to bottom it is not delayed by reading the javascript - that might not even be doing anything. By doing this you will also be confident that any elements that the js is handling will already be creates - the same as variable referenced before assigned. Use // to comment code