title: How to change button color onclick using javascript only?
body: <p>I was trying to make the color of the buttons change using onclick and getElementsByClassName and came up with something like this: </p>
  
  <p>HTML: </p>
  
  <pre><code>&lt;button onclick="submitButtonStyle()" type="submit" class="stylebutton"&gt; 
  Submit &lt;/button&gt;
  </code></pre>
  
  <p>JS: </p>
  
  <pre><code>function submitButtonStyle() { 
  document.getElementsByClassName("stylebutton").style.backgroundColor = "red"; }﻿
  </code></pre>
  
  <p>I would be really grateful if you guys gave me a hint about what is lacking in my code/what I should add etc. </p>