title: How to append a method to my button?
body: <p>I have a function called getRandomColor() and I want to apply this method to my button in the HTML doc. So, when you click the button it changes the entire body's color. </p>
  
  <p>This is the javascript code: </p>
  
  <pre><code>function getRandomColor() {
      var letters = '0123456789ABCDEF'.split('');
      var color = '#';
      for (var i = 0; i &lt; 6; i++ ) {
          color += letters[Math.floor(Math.random() * 16)];
      }
      return color; 
    }
  </code></pre>
  
  <p>This is the HTML code for the button and my attempt to apply the JS code:</p>
  
  <pre><code>&lt;div class="row"&gt;
          &lt;div class="col-6-xs"&gt;
            &lt;button onclick="getRandomColor()"id="quotes"type="button" class="right-btn pull-right btn btn-success"&gt;Get Quotes&lt;/button&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>Right away, I can tell that clicking the button won't change the document's color. I was thinking of adding this code to the getRandomColor() method: </p>
  
  <pre><code>document.body.style.background = color;
  </code></pre>
  
  <p>However, it still doesn't change the document color. </p>