Design comparison
Solution retrospective
Didn't really have any challenges here, but I enjoyed practising my Javascript skills :)
Community feedback
- @VCaramesPosted almost 2 years ago
Hey there! 👋 Here are some suggestions to help improve your code:
- The “icons/illustrations” in this component serve no other purpose than to be decorative; They add no value. There
alt tag
should be left blank and have anaria-hidden=“true”
to hide them from assistive technology.
More Info:📚
https://www.w3.org/WAI/tutorials/images/
- The proper way to build this challenge is to create a
form
and inside of it, the “rating buttons” should be built using aninput radio
(wrap all of them inside afieldset
), since this will prevent additional buttons from being active at the same time, and it should have alabel
element attached to it for accessibility.
More Info:📚
MDN <fieldset>: The Field Set element
If you have any questions or need further clarification, feel free to reach out to me.
Happy Coding!🎄🎁
Marked as helpful0 - The “icons/illustrations” in this component serve no other purpose than to be decorative; They add no value. There
- @AdrianoEscarabotePosted almost 2 years ago
Hi Kathryn, 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:
ratingbutton.forEach(function (item) { item.addEventListener("click", function (event) { event.preventDefault(); ratingbutton.forEach(function(item) { item.classList.remove("active"); }) item.classList.add("active"); let selectedRating = item.innerText; document.querySelector(".ratingselection").innerText = `You selected ${selectedRating} out of 5`; submitbutton.addEventListener("click", function (event) { event.preventDefault(); document.querySelector(".ratingcomponent").style.display = "none"; document.querySelector(".thankyoucomponent").style.display = "flex"; }); }); });
The rest is great!
I hope it helps... 👍
Marked as helpful0@KathrynDavies123Posted almost 2 years ago@AdrianoEscarabote thanks! didn't think about that :)
1
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