Hey everyone, I’m having a play about with some JavaScript and cant seem to get this code working locally. It’s something from fiddle, but when putting into a local folder, it no longer works. Here is my code:
99.99%+ of JavaScript works best when attached to the bottom of the page.
The only two exceptions I have come across are framebreaker scripts and scripts such as Modernizr that add classes to the <html> tag so that the page can be styled based on what JavaScript the browser supports.
Another thing to consider: Are you accessing this via “file:\\\C:\path\to\document\index.html” or “http://localhost/document/index.html”? A lot of times I’ve tried testing JavaScript not realising that I’m using the “file:” protocol instead of the “http:” protocol. It can make a difference (although not always.)