Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 2 years ago

Html/Css/Js used and it was a good example for learning DOM

furkan 🧑🏻‍🎨•30
@furkankucukkiris
A solution to the Interactive rating component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


It is not responsive yet. You can suggest ideas and make corrections, feel free!

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Account deletedPosted over 2 years ago

    Hey there! 👋 Here are some suggestions to help improve your code:

    • Change width to max-width in your component’s container to make it responsive. You will also want to delete the height as it is unnecessary.
    • The “icons/images” in this component serve no other purpose than to be decorative; They add no value. There alt Ttag should be left blank and have an aria-hidden=“true” to hide them from assistive technology.

    More Info:📚

    https://www.w3.org/WAI/tutorials/images/

    • The proper way to build this challenge is to create a form and inside of it, the “rating buttons” should be built using an input radio (wrap all of them inside a fieldset), since this will prevent additional buttons from being active at the same time, and it should have a label element attached to it for accessibility.

    More Info:📚

    MDN <input type="radio">

    MDN <fieldset>: The Field Set element

    • Currently, users can submit without selecting a rating. To fix this, you can do one of the following:
    1. Make the “5” rating the default rating.
    2. Create an error message, telling users they need make a section.
    3. Disable the button until a selection is made.

    If you have any questions or need further clarification, feel free to reach out to me.

    Happy Coding!🎄🎁

    Marked as helpful
  • Adriano•42,890
    @AdrianoEscarabote
    Posted over 2 years ago

    Hello furkan, how are you? I truly loved your project's outcome, however I have some advice that I hope you'll find useful:

    To make the submit button work only when the user selects a number, we can do this:

    rates.forEach((rate) => {
        rate.addEventListener('click', () => {
            rate.style.backgroundColor = 'grey';
            rate.style.color = 'white';
            rating.innerHTML = rate.innerHTML;
            submitButton.addEventListener('click', () => {
                mainContainer.style.display = 'none';
                thanksContainer.style.display = 'flex';
            });
        })
    })
    

    The remainder is excellent.

    I hope it's useful. 👍

  • Cris Augusto•160
    @Cristhyam-Augusto
    Posted over 2 years ago

    Hi Furka how are you?? Congratulations on the design, it was really identical. I did a project like this yesterday, and I got some feedback that might be useful for you too: I noticed that I can send a review even without filling in the value, so you can change the code as below to avoid this.

      rate.addEventListener("click", () => {
        rate.style.backgroundColor = "grey";
        rate.style.color = "white";
        rating.innerHTML = rate.innerHTML;
        submitButton.addEventListener("click", () => {
          mainContainer.style.display = "none";
          thanksContainer.style.display = "flex";
        });
      });
    }); 
    

    I also noticed that in the html you used ID and class references for the LI, but I don't think that's necessary, because you used only classes in css. In general I think that's it, congratulations on the work, it was really good.

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

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