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

learner11 60

@b-kuhu

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


Although the project is working as expected,but in my index.js file:

//adding click event lister for submit button
    submitBtn.addEventListener('click',()=>{
        if(ratingState.style.display != 'block'){
            console.log(clickedRatingVal);
            //rating card will not display and thank you card will display
            ratingState.style.display = 'none';
            thankState.style.display = 'block';
            //shows the rating selected by the user
            ratingMsg.innerHTML = `You selected ${clickedRatingVal} out of 5`; 
        }
    }) 

I set the display of div to block for my rating-state div but when i tried changing its state using (ratingState.style.display == 'block') , this value came out to be false instead of true.So the only option for me was to use (ratingState.style.display != 'block . Can anyone help why this doesnt work out.Thanks in advance.

Community feedback

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