Need help for events 3 skill text

hi i get stuck to completing task 3 in events test skill can anyone help me?

i know that i should do it by event delegation but i don’t know how to do it.

here’s the link of task

https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Test_your_skills:_Events#events_3

Hi @alireza_alinezhad

I hope I’m not too late for a hint.
Below you see the solution code with just the right part of the assignment missing.

  • The target property of the event object (e) points to the element that was actually clicked.
  • Use getAttribute() to get the color from this element
function setColor(e) {
  buttonBar.style.backgroundColor = /* Add the missing part */ ;
}

buttonBar.addEventListener('click', setColor);

See you,
Michael