Design comparison
Solution retrospective
Hi com!!!
Please review this project for me. I built it using Vanilla Js and I get to experience the use of " :root CSS pseudo-class" in the project.
Please check it out and let me know what I can do better.
Thanks! Happy Coding!!!
Community feedback
- @AdrianoEscarabotePosted almost 2 years ago
Hi Pretty Kunene, how are you? I really liked the result of your project, but I have some tips that I think you will enjoy:
To make the
submit
button work only when the user selects a number, we can do this:ratingNumber.forEach((number) =>{ number.addEventListener("click", () =>{ console.log("number correct"); selectedNumber.innerHTML = number.innerHTML; submitBtn.addEventListener('click',function(){ if (ratingSection[0].style.display = "block"){ ratingSection[0].style.display = "none"; thankSection[0].style.display = "block"; } else { thankSection[0].style.display = "none"; ratingSection[0].style.display = "block"; } }) }) })
The rest is great!
I hope it helps... 👍
Marked as helpful0@nonozaPosted almost 2 years ago@AdrianoEscarabote Thank you so much for the code. I actually had an if statement solution but don't know how to approach it.
Thanks a lot!!!
1 - @itadori-kunPosted almost 2 years ago
Hello Pretty, Great work and nice code, it is fantastic. Here is a little suggestion.
- You forgot the: hover and :active on the class ratings.
- Validate your submit btn to only submit when a rating number has been selected to avoid pushing out blank on the innerHTML part.
- Try using more semantic tags instead of non-semantic tags like("divs"). Check this out to understand more: "https://www.w3schools.com/html/html5_semantic_elements.asp" or "https://www.freecodecamp.org/news/semantic-html5-elements/".
Hope you find this helpful!!!. Happy coding 👻💜💜
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