Buttons

by djKliter

HTML

<button class="button1">Кнопка1</button> <button class="button2">Кнопка2</button>

JavaScript

var button1=document.getElementById('.button1');
var button2=document.getElementById('.button2');
button1.addEventListener('click',function(){
    this.style.backgroundColor='red';
});
button2.addEventListener('click',function(){
  button1.style.backgroundColor='green';
});