Design comparison
Solution retrospective
There are some vital issues, like when you click on a particular number, you can also click other numbers for some reason. On top of that, I couldn't make that statement which tells you how you rated. In general, I think my code is very messy and I'd love to know any best practices to solve this challenge, especially I would like your feedback on my JavaScript since it's my first time doing anything using JS.
Community feedback
- @JexintePosted over 2 years ago
Hey Good job,
I'm beginner too so I'm just gonna say to you what you could improve on your solution and if there is any other things that I haven't notice I'm sure someone will notice you, so :
-
I think you could use less div for more semantics tag an example on your buttons you could use radio input they are more meaningful because you are suppose to allow the user to select just one rating not all of them and it's more easier to check if one of your radio button is selected then you can pop up your thank card with the right value on the thanks paragraph.
-
I see that your submit button have no checking on this challenge it's not a big deal but imagine if you have a bigger site and no verification before sending information who know what's gonna happend : ) So it's just a recommandation there is no obligation but you can use this method e.preventdefault() it will block the default behavior of the submit button allowing you to check which button have been selected then pop up your thanks card !
More details here : https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault
- I think but perhaps I'm wrong but the condition that you've wrote for styling all buttons on orange is not necessary I repeat it it's just my understanding of the challenge but I think that the button from 1 to 4 is only on grey color when you select them and the last one is on orange.
So on you button from 1 to 4 you could give them a class and go on your css file and write something like that :
classname:focus { background-color : yourcolor; }
Then each button having the classname when selected is gonna get the background-color that you have set. I check right now it seems on div the property is not working.
In hope it helps you !
1 -
Please log in to post a comment
Log in with GitHubJoin 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