title: Toggle button color on click
body: <p>Here I have written a <code>JavaScript</code> to change color of button to green when clicked once and when I click the button again its color should change back to orange color. The default color of button is orange. I have given the <code>rgb</code> values of color. But, when I click the button its color changes from orange to green and when I click it again its color remains green doesn't change back to orange. please help me to fix this. </p>
  
  <pre><code>&lt;script&gt;
  function colorchange(id)
  {
  
    var background = document.getElementById(id).style.background;
  
    if(background = "rgb(255,145,0)")
    {
    document.getElementById(id).style.background = "rgb(26,255,0)";
    }
    if(background == "rgb(26,255,0)")
    {
      document.getElementById(id).style.background = "rgb(255,145,0)";
    }
  
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Here is the HTML code for input button</p>
  
  <pre><code>&lt;input type="button" name="Ignore Select" value="Ignore Select" id="select" onclick="colorchange('select')" style="background:rgb(255,145,0);"/&gt;
  &lt;input type="button" name="Ignore Delete" value="Ignore Delete" id="select1" onclick="colorchange('select1');" style="background:rgb(255,145,0);"/&gt;
  &lt;input type="button" name="Ignore Insert" value="Ignore Insert" id="select2" onclick="colorchange('select2');" style="background:rgb(255,145,0);"/&gt;
  &lt;input type="button" name="Ignore Update" value="Ignore Update" id="select3" onclick="colorchange('select3');" style="background:rgb(255,145,0);"/&gt;
  &lt;input type="button" name="Ignore Sleep" value="Ignore Sleep" id="select4" onclick="colorchange('select4');" style="background:rgb(255,145,0);"/&gt;
  </code></pre>