@Jonyango
Posted
Hi Samantha,
First of all, good job getting most of the aspects of the solution to work. You have done well. As Johnny has already said, using radio buttons would have been a better HTML choice, especially when trying to ensure once a user picks a single value and if they change to a different value, only the value they have currently chosen is highlighted.
Secondly, using your current approach, instead of listening for individual li
elements, you could have listened for the click event on their parent element, enabling you to write the click event only once. This is something called event delegation. You can read about it here.
Marked as helpful