title: javascript function on multiple buttons
body: <p>I have three buttons. I would like them to change colour when pressed, and back to no colour when pressed again.</p>
  
  <p>I found this code on stackoverflow that allows me to almost do it however, it only works on one button, the other two are not affected.<br>Also, when I pressed one of the other two buttons, the first button changes colour. I tried changing ID's on the buttons, adding another script with different <code>getElementById()</code> ID's but nothing works.</p>
  
  <p>Do I need more than one function to achieve what I want?</p>
  
  <p>The code I am using is below.</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>var count = 1;
  function setColor(btn, color) {
    var property = document.getElementById(btn);
    if (count == 0) {
      property.style.backgroundColor = "#FFFFFF";
      count = 1;
    } else {
      property.style.backgroundColor = "#E68352";
      count = 0;
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;head&gt;
    &lt;link rel="stylesheet" type="text/css" href="styles/main.css"/&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;input type="button" id="button" value = "A-D" style= "color:black" onclick="setColor('button', '#101010')";/&gt;
    &lt;input type="button" id="button" value = "E-H" style= "color:black" onclick="setColor('button', '#101010')";/&gt;
    &lt;input type="button" id="button" value = "E-H" style= "color:black" onclick="setColor('button', '#101010')";/&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>