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

Laissaf 60

@faissal-aL

Desktop design screenshot for the Interactive rating component coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Community feedback

Adriano 33,970

@AdrianoEscarabote

Posted

Hello Laissaf, 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 make some changes:

possibleRatings.forEach(function(e) {
    e.addEventListener("click",function(){
        let arr = possibleRatings.filter(l => l != e);
        e.style.backgroundColor = 'hsl(25, 97%, 53%)';
        arr.forEach(l => l.style.backgroundColor ='hsl(214, 19%, 23%)');
        ratingValue = e.innerHTML;      
        submit.addEventListener("click", function(){   
    	    rating.style.display ='none';
    	    thanks.style.display ='block';
    	    thanksrating.innerHTML = 'You Selected '+ratingValue+' out of 5';
	})
    });
});

The remainder is excellent.

I hope it's useful. 👍

Marked as helpful

1

Laissaf 60

@faissal-aL

Posted

@AdrianoEscarabote Thank you for your help ! I didn't notice that problem before, I corrected it now. thanks !

1
Adriano 33,970

@AdrianoEscarabote

Posted

@faissal-aL happy coding!!

1

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