Design comparison
SolutionDesign
Solution retrospective
In js, can the code be more optimal?
Community feedback
- @martinablazheskaPosted 12 months ago
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@Bluz0Posted 12 months ago@martinablazheska yes I understand , it's better than 5 pages :) Thank you !
0
Please log in to post a comment
Log in with GitHubJoin 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