@nicodes-dev
Posted
Hi! I have a few suggestions for your solution.
-
In this challenge it is not bad to add a default rating if the user didn't select a rating and clicked submit but I think it is better if you'll add a simple validation that won't allow the user to submit it without selecting a rating or you can also add an error message that tells the user that they haven't selected a rating before clicking submit.
-
I notice that in your media query, you use a max-width of 375px. Is this intended to only be displayed on a mobile device? If not, maybe you can try to make it responsive with adding more media query. I suggest that you use a min-width of 320px or 360px and just add a max-width on your parent container so it won't stretch too much.
-
The active class is not working properly, the background color and color only apply after selecting another button and it also allow multiple ratings to get an active class. You can use a loop to check whether your button should have an active class. You should use addClass and removeClass instead of toggleClass for this to work.
Marked as helpful
@Loocee
Posted
@baldmannnnn thank you, I have fixed it.