Skip to content

Commit

Permalink
background color changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kmr18006 committed Mar 21, 2024
1 parent f09c1e9 commit 9c3d9b0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion week-09/event3/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
});

</script>
</body>
Expand Down

0 comments on commit 9c3d9b0

Please sign in to comment.