Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Interactive rating component

@SamL2021

Desktop design screenshot for the Interactive rating component coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Would love feedback on how I can improve my flexbox knowledge. I found creating the circles around the numbers difficult and I know there was a better way to iterate through the numbers and return the value in my JS. My solution felt janky but I am just coming back to coding after a long break and I had only learnt the basics previously. I really enjoy seeing my solution working and look forward to improving my skills and ability.

Community feedback

@Jonyango

Posted

Hi Samantha,

First of all, good job getting most of the aspects of the solution to work. You have done well. As Johnny has already said, using radio buttons would have been a better HTML choice, especially when trying to ensure once a user picks a single value and if they change to a different value, only the value they have currently chosen is highlighted.

Secondly, using your current approach, instead of listening for individual li elements, you could have listened for the click event on their parent element, enabling you to write the click event only once. This is something called event delegation. You can read about it here.

Marked as helpful

2

@johnny-estrada

Posted

Hi Samantha,

Welcome back to coding! I just completed the same project and also struggled with the radio buttons. I had to google a lot before I got them right and the JavaScript section.

Here's my feedback: Instead of list items, inputs with a type of radio button would have been a better choice for the HTML. Inputs allow us to use this cool CSS trick that lets us style the checked checkbox easily, and use less code in our JS. Here' the link to my solution if you're curious about how I solved it using form inputs: https://github.com/johnnye562/interactive-rating-component.

Keep up the good work! Hope this helps!

Cheers, Johnny

Marked as helpful

1

@SamL2021

Posted

@johnnye562 thank you and thank you for your feedback, I will definitely look at inputs instead of using the ul. I wanted to check out your solution but couldn't see your repository, perhaps its private?

0

@johnny-estrada

Posted

@SamL2021 You're welcome! I just updated the settings, so you should be able to see it now. If not, please let me know.

Cheer, Johnny

0

Please log in to post a comment

Log in with GitHub
Discord logo

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