From 9c3d9b0f463832524f52dc5992585e55e25a9261 Mon Sep 17 00:00:00 2001 From: Kara Rondinelli Date: Thu, 21 Mar 2024 15:27:59 -0400 Subject: [PATCH] background color changes --- week-09/event3/index.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/week-09/event3/index.html b/week-09/event3/index.html index 4b3b8b4..0797d63 100644 --- a/week-09/event3/index.html +++ b/week-09/event3/index.html @@ -41,7 +41,12 @@ const buttonBar = document.querySelector('.button-bar'); - // Add your code here + buttonBar.addEventListener('click', function(event) { + if (event.target.tagName === 'BUTTON') { + let color = event.target.dataset.color; + buttonBar.style.backgroundColor = color; + } + });