Interactive rating component

Solution retrospective
I completed this challenge with the most basic vanilla CSS and JS. I think that my CSS could be better structured and therefore more concise. I hope this is something that I will be able to achieve when I start using CSS frameworks.
I found JS really difficult - at first, I tried it with named function and loops, but could not get it to work. So I went back to the very basics and ended up with the ugly code as it is right now. I shall come back to it and refactor it at some point.
I would appreciate any pointers about refactoring this JS code.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @NicolasBQ
Hey @wglebster, nice solution!! It looks great.
If u want to refactor your JS I recommend u to use the same class name for all the rate buttons, then u can select them all with querySelectorAll and manipulate them as an array. I did it in that way (except I used data attributes), so feel free to check my code.
Good Job!
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