Created
July 31, 2022 05:56
-
-
Save modos/bf32197ec63bef5c939fd7e6bd4ad4e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const buttons = document.querySelectorAll('.button'); | |
buttons.forEach(button => { | |
button.addEventListener("click", clicked); | |
}); | |
function clicked(e) { | |
const color = e.target.id; | |
document.body.style.backgroundColor = color; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment