Submitted about 2 years ago
Interactive rating component using HTML, CSS flexbox & Vanilla JS.
@gauravsingh1281
Design comparison
SolutionDesign
Solution retrospective
Have a look over my code and give a suggestions on how i can improve my coding skills.
Community feedback
- @mrxshinjiPosted about 2 years ago
For your alert code, it is better not to touch innerText with js whenever possible in my opinion. Its like all the changes in structure should keep in html, script changes in js, and stylechanges in css .
I would use css {display: none} and {display: block} to show the text by adding active class instead.
<p id="alert">"Please select a number"</p>
#alert{ display: none; } #alert.active { display: block { }
document.querySelector("#alert").classList.add("active")
This should be the way to write this....
Marked as helpful0
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