Exercise Set 2

Exercise 1 of 6

Change the button's background color when it's clicked. Watch the setting style video.

HTML

<button id="changeColorButton">Change color</button>

JavaScript

var changeColorButton = document.getElementById("changeColorButton");

changeColorButton.addEventListener("click", changeColor);

function changeColor() {
    // your code will appear here
}

You must be signed in to type your code.

Last topic Next exercise