Design comparison
SolutionDesign
Solution retrospective
What specific areas of your project would you like help with?
tips to improve my js would be helpful
Community feedback
- @Rgit915Posted 8 days ago
@Sandaruwan7056, Your component looks fantastic! 😊
Just a quick tip:
-
since you’re only targeting the first .rating-start-container and .rating-thankyou-container elements, you could use querySelector instead of getElementsByClassName for a cleaner approach.
const container = document.querySelector(".rating-start-container");
const thankYouContainer = document.querySelector(".rating-thankyou-container");
-
And one more thing: to avoid potential errors, you can add a quick check to make sure yourRating exists in the DOM before updating it:
if (yourRating) yourRating.textContent = getValue;
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