Interactive rating, HTML/CSS/JS

Solution retrospective
Eventually, I suppose it works as it should work. I had a bit issue with active state of the buttons which I solved by using another loop inside the first loop (I could not think of another solution).
Please log in to post a comment
Log in with GitHubCommunity feedback
- @AgataLiberska
Hello :)
I think you made this a bit more difficult for yourself going for buttons with ratings where this really is a small form with 5 radio inputs - So I would visually hide the inputs themselves (key word is visually , display:none wouldn't be a great choice) and style the labels to be the circles you click and then pass this to the submit event :)
And if you want to change the look of the buttons after pressing one, loop or forEach is an ok choice, but I would simplify your code by having an 'active' class and then just using
classList.toggle('active')
hope this helps :)
Marked as helpful
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord