title: Javascript Error Null is not an Object
body: <p>Im getting a error in the Web Inspector as shown below:</p>
  
  <pre><code>TypeError: 'null' is not an object (evaluating 'myButton.onclick = function() {
  var userName = myTextfield.value;
  greetUser(userName);
  
  return false;
  
  }')
  </code></pre>
  
  <p>Here is my Code (HTML):</p>
  
  <pre><code>&lt;h2&gt;Hello World!&lt;/h2&gt;
  &lt;p id="myParagraph"&gt;This is an example website&lt;/p&gt;
  
  &lt;script src="js/script.js" type="text/javascript"&gt;&lt;/script&gt;
  
  &lt;form&gt;
    &lt;input type="text" id="myTextfield" placeholder="Type your name" /&gt;
    &lt;input type="submit" id="myButton" value="Go" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Here is the JS: </p>
  
  <pre><code>var myButton = document.getElementById("myButton");
  var myTextfield = document.getElementById("myTextfield");
  
  function greetUser(userName) {
  var greeting = "Hello " + userName + "!";
  document.getElementsByTagName ("h2")[0].innerHTML = greeting;
  }
  
  myButton.onclick = function() {
  var userName = myTextfield.value;
  greetUser(userName);
  
  return false;
  
  }
  </code></pre>
  
  <p>Any Idea why I am getting the error?</p>