Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 1 year ago

Interactive-rating-main By JonathanBees Js, Css, Html

web-components, webflow, theme-ui
Jonathan Betancur•90
@Jonathanbees
A solution to the Interactive rating component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Issues during the creation of this challenge

Distribution of buttons

  • Create each button (the 5 circles of the rate) was so difficult especcially because i was changing sometimes the HTML elements, for example, at the beggining i create these with only div division, then, searching, i found that is easier to create input and label elements to just hide the input elements and work with the label elements, but at least i learn a little more about html forms :)

  • i didn´t find the way to put the 5 circles and the button at the same time thinking about how can i do to validate that the input element needs to be selected before pressing the button to show the next section, i appreciate if anyone can advice me about it, this will help me a lot

Javascript functionalities

  • First of all, during the creation of the click function to change the color of the selected circle i was a little confused of how can i pick all of the 5 items without having a id or a class according to each of these (in the code i let some of my attempts to recreate that function seeing that all of that was true :3)

  • then, i don´t understand so much of how can i collect the information of the button (the number) that was pressed, after a few attemps, i found that the method: stringify() can help me with that and then, just transform my string into a char with just a chartAt method

  • Finally, i understand that i can just add or remove classes (like the click function) to hide or show the part that is interesting to me, in this case, the thanks section once i press the submit button, i also learn a little of how to create HTML elements with javascript to push them in the section that i needed

Learnings during the developing of this challenge

  • I learn a lot more about some CSS elements, i hope that one day i will do it more mechanically :), it´s obvious that i need to learn a lot more, and maybe in this challenge the code it´s not the better optimized, but it´s an attemp, i need to learn more about specially in the responsive design, because i don´t understand a lot of how to do that, i will be very gratefull if someone can give me some advices according to this

  • I learn a little more about javascript DOM manipulation, it´s a long way to understand all the javascript that i want to learn, but one step a time, if you read this, if you can give me advices of my distribution of my javascript code to improve it, or explain me of how could i resolve the issues that i had, i´ll be very grateful :3

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • alirs07•120
    @alirs07
    Posted over 1 year ago

    Hi. User can select multiple options, you can fix that by simply adding the name attribute with the same values to the inputs.

    To validate if any input is selected I did this: I declared a variable with the value of 0, then with a forEach method check if any input is selected then change the variable value to input value.

    Hope that helps you!

    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
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub