title: Simple event listener not working - JS
body: <p>I have written an increbily simple event listener and yet it comes up with the error: <code>Uncaught TypeError: Cannot call method 'addEventListener' of null</code> which suggests it is to do with the id maybe (also it works with <code>document</code>?</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;script type="text/javascript"&gt;
          function message () {
          alert("Hello!");
          }
          var button = document.getElementById('button');
          button.addEventListener('click', message, true);
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;input type="button" id="button" value="Click me!" /&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>(I know I'm going to feel stupid after this, but I am a JS noob)</p>