<!DOCTYPE html>
<html>
<body>

<p>Click the button to change its background color.</p>

<button id="myBtn">Try it</button>

<script>
document.getElementById("myBtn").addEventListener("click", function(){
    this.style.backgroundColor = "red";
});
</script>

</body>
</html>