title: Generating Javascript random number into HTML
body: <p>Need help with Javascript to generate number in HTML. I'm close but can't get it to quite work. Help would be appreciated.</p>
  
  <p><a href="http://jsfiddle.net/xmPgR/251/" rel="nofollow noreferrer">http://jsfiddle.net/xmPgR/251/</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function getNumber() {
      var minNumber = 0; // The minimum number you want
      var maxNumber = 100; // The maximum number you want
      var randomnumber = Math.floor(Math.random() * (maxNumber + 1) + minNumber); // Generates random number
      $('#myNumber').html(randomnumber); // Sets content of &lt;div&gt; to number
      return false; // Returns false just to tidy everything up
  }
  
  window.onload = getNumber; // Runs the function on click
  document.getElementById("yourNumber").innerHTML = randomnumber;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="myNumber"&gt;&lt;/div&gt;
  &lt;p id="yourNumber"&gt;
  &lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>