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

HTML , CSS , And JS interactive card

@NawalMalki

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

P

@elyyyse

Posted

Hey, Nawal - Nice work! I made a pull request here, so you can see the few lines I added to grab the rating value and present it on the next card.

Basically, I selected the <div class="rating"> on the Thank You card and named it confMsg. Then in your change() function, I assigned the value of selectedDiv to a variable and updated the confMsg with that. This solution breaks some of your styling, but hopefully it gets the point across.

Next time, consider using <label> tags instead of <div>s for your <input>s. That way, even when you hide the default styling with display: none;, the <input> itself still gets selected when a user clicks on the styled <label>. Then you can take advantage of native functionality and use something like document.querySelector('input[type="checkbox"]:checked') to get the value. (I would also recommend radio buttons over checkboxes for this particular use case.)

I hope this makes sense. Feel free to reply back with questions!

0

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