<style>
  .worked {
    background-color: #090;
  }
</style>
<div>
  <button id='press'>
    Click Here to Change the Button Color!
  </button>
  
  <br /><br />
  
  <button id='press2'>
    Click Here to Change the Button Color 2!
  </button>
</div>
var button = document.getElementById('press');
button.addEventListener('click', () => {
  this.classList.toggle('worked');
});

var button = document.getElementById('press2');
button.addEventListener('click', function() {
  this.classList.toggle('worked');
});
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.