title: How can I print using `document.getElementByID("results").innerHTML = results?
body: <p>When I click the roll button, nothing happens. Is there a way to show the results using <code>document.getElementByID("results").innerHTML</code>, or is this not recommended?</p>
  
  <p><strong>HTML</strong> </p>
  
  <pre><code>&lt;p&gt;How many dice?
      &lt;br/&gt;
      &lt;input type="text" id="numDice" /&gt;
  &lt;/p&gt;
  &lt;p&gt;How many sides per die?
      &lt;br/&gt;
      &lt;input type="text" id="numSides" /&gt;
  &lt;/p&gt;
  &lt;button onclick="diceRoll()" id="roll"/&gt;Roll!&lt;/button&gt;
  &lt;p id="results"&gt;&lt;/p&gt;
  </code></pre>
  
  <p><strong>JavaScript</strong></p>
  
  <pre><code>var numDice = document.getElementByID(numDice).innerHTML;
  var numSides = document.getElementByID(numSides).innerHTML;
  
  function diceRoll() {
    var results = "";
  
    for (var i = 0; i &lt; numDice; i++) {
      results += (Math.random() * numSides) + 1;
    }
  
    document.getElementByID("results").innerHTML = results;
  }
  </code></pre>
  
  <p><a href="http://codepen.io/jdash86/pen/oaLHC" rel="nofollow" title="CodePen">CodePen</a></p>