@elaineleung
Posted
Hi Nicola, great job completing this second challenge! Well done in learning who to use forEach
and then applying it to this project 😊
I'll try to give some feedback here, just two points:
-
I see that in your
addEventListener
you are usingfocus
for the buttons, and this can have some problems. If you click on a button and then accidentally click something else, such as the text or even the background, your button will lose focus, and it will look like no buttons were selected, even though the score is already collected in the background. What you want to do instead is to use a class for styling. In the CSS, you can write aselected
class with the style changes and then use the event listener to add the class. The CSS can look like this:.is-selected { background-color: hsl(25, 97%, 53%); color: hsl(0, 0%, 100%); }
-
If I don't select anything but hit the Submit button, I still get brought to the "thank you" page. You can try to write an if statement to prevent that from happening.
If you need any ideas, you can check out the CodePen that I made for this challenge: https://codepen.io/elaineleung/pen/RwMqMxZ
Once again, great job with all the research and learning!
Marked as helpful