
Interactive Rating Component using HTML, CSS and JavaScript
Design comparison
Solution retrospective
I am mostly proud because I have completed my first JavaScript Project.
What challenges did you encounter, and how did you overcome them?I encountered the challenge to make the numbers selected after clicking. After using a JS, I easily solved the problem.
What specific areas of your project would you like help with?In my JavaScript file, I used ID to make the style for selected rating. If you find any better way to do it, please let me know.
Community feedback
- @MarziaJaliliPosted 17 days ago
Awesome work!
Some areas you can amend:
-
First, for the rating buttons instead of using the
<p>
element you could use the<button>
. To make sure your web contains semantic elements. -
Second, if you want the buttons to be a perfect circle, set it's
width
andheight
to a same number and then the propertyborder-radius: 50%;
you've already set for it will change it to a perfect circle:
button { width: 25px; height: 25px; border-radius: 50%; }
- In addition, for a well-stractured repository consider moving all the images to one specific folder like
images
. To make it more understandable to those who may have a look at your code.
The web look outstanding overall, keep it up!
😎😎😎
0@methane-jsPosted 16 days ago@MarziaJalili Thanks a million. But can you please tell me about the JavaScript code in my file? In there I have used a separated ID to make the selection of the rating numbers.
Is there any better way to do it?
1@MarziaJaliliPosted 13 days agoMy apologies for this late reply!
As long as you are recalling a specific element in JavaScript it is totally fine to go with the
id
attribute.If not it is better to stick with the
class
attribute.And I guess you've set the attribute for different elements with the a same value
numbers
and it's not a good practice, bro. Because the id attribute should be unique within a document.Hope this answers your question!
0 -
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