title: i'm getting an Uncaught TypeError: Cannot set property 'onclick' of null?
body: <p>i'm getting uncaught type error of:
  Uncaught TypeError: Cannot set property 'onclick' of null </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;dice app&lt;/title&gt;
          &lt;script src="widget.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;button id="button"&gt;Roll Dice&lt;/button&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>js code:</p>
  
  <pre><code>var button = document.getElementById("button");
  
  button.onclick = function() {// error
      var print = dice.roll();
      printNumber(print);
  };
  </code></pre>