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

Making choice (My first js project)

Bluz0 50

@Bluz0

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


In js, can the code be more optimal?

Community feedback

@martinablazheska

Posted

To avoid the duplicated code you currently have (i.e. a different page for each rating outcome), you can have a single html page where

<div id="msg">You selected 4 out of 5</div>

is replaced by

<div id="msg">You selected <span id='result'>4</span> out of 5</div>

Then, in your script.js, you can select the 'result' span by its id and change the inner HTML to show the result which the user clicked on.

To see what I mean , you can check out my solution of this exercise. https://www.frontendmentor.io/solutions/interactive-rating-component-pvk6CV-bFN

I hope this was helpful :)

2

Bluz0 50

@Bluz0

Posted

@martinablazheska yes I understand , it's better than 5 pages :) Thank you !

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