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

Interactive rating component Using Html, CSS & JavaScript

itcss, jss, node, sass/scss
gourab chatterjee•70
@TheRedBandiCoot
A solution to the Interactive rating component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


🗯 In every project I've got a lot of ideas to put in but due to a lack of knowledge in coding and the right time to use the right logic to accomplish the idea I thought it very hard for me to achieve.

➡ In this particular project using javascript to make this page interactive is the most challenging part for me honestly.

➡ Later while working on making the animated submit button & use the Transform CSS property to make the after submitting animation more interactable is quite a challenging part for me but also interesting at the same time.

🗯 In Some of the areas in the javascript part of the code I'm quite unsure whether the logic is right or wrong Please Check This Code Snippets Out And Help Me Out 👇👇👇👇👇👇👇👇👇👇👇👇👇👇 Repository URL for All Code Snippets

btn.addEventListener("click", (e)=>{
        buttonColorChange.forEach((e)=>{
          if (e.classList.length === 2) {
            setTimeout(() => {
              forNoneAdder()
              isShow.classList.remove("fornone")
              add.innerHTML = e.innerHTML
            }, 250);
            container.classList.add("isShow")
          } else{
            btn.classList.add("ani")
            setTimeout(()=>{
              btn.classList.remove("ani") 
            },500)
          }
        })
      })

➡ Here In This part of the code, when I click the button ani class add to the button but it will get removed after 500ms but when I again click the button and check the element tab from developer tools in google I see the ani class already there and in the console, panel show me 5 buttons when I console.log(btn)

➡ I also apply the ani class in the else condition when the button got clicked without selecting the rating number but the class also added in if condition I don't why PLEASE CHECK THIS OUT this problem

🗯 I gonna check out more projects to work on in Frontendmentor.io

⌘This Is RedBandiCoot Signing Off

stay hungry stay foolish—Stewart Brand

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Ernest Push Gbaboh•460
    @gbabohernest
    Posted over 3 years ago

    Hey there 👋 Great work on completing the challenge... I liked the amination effect on the thank you component. Great work 😊😊.

    You can try and improve the HTML a little bit

    -Try to wrap your contents in the main tag to avoid accessibility issues instead of a div.

    -As for the JavaScript, it looks good, but yet still it can be improved by reducing some lines of code. I can see you selected so many elements. In my opinion, you needed only a few, like the .numbers & .btn. Always try to keep things as simple as possible you can and remember there are multiple ways to solve a problem. keep up the good work 👍👍.

    Happy Coding ✔👍

    Marked as helpful
  • Renan Tiscoski•1,240
    @DonUggioni
    Posted over 3 years ago

    Hey,

    I think your solution looks great! I like the animation when you click the submit button, might even implement that on my own project 😁

    A few things I can point out are:

    • Start using rem instead of px when styling. Px are a fixed measure, which means they will never change no matter the user settings or in case the page is responsive.

    • The submit button is a little too big, I would reduce the padding to maybe 10px/15px.

    • When using querySelectorAll, I like to use a for loop to go through the Array. When you select many elements with the same class using querySelectorAll, you get a node list which is similar to an array, so you can loop through it and save a few lines of code and make it easier to read.

    But, there is always many ways to do the same thing, and it works which is what matters.

    Other than that, it looks great!

    Keep it up and hope to see more projects from you in the future!

    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

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