Design comparison
Solution retrospective
Hey, I wasn't able to figure out how to make it compulsory for users to select at least one rating button. Any suggestions on how it can be done?
Community feedback
- @AdrianoEscarabotePosted about 2 years ago
Hi Manan Khurana, how are you?
I really liked the result of your project, but I have some tips that I think you will enjoy:
- every Html document must contain the main tag, so we can identify the main content, to fix this, wrap all the content with the main tag. HTML5 landmark elements are used to improve navigation experience on your site for users of assistive technology.
- Consider using rem for font size .If your web content font sizes are set in absolute units, such as pixels, the user will not be able to re-size the text or control the font size based on their needs. Relative units “stretch” according to the screen size and/or user’s preferred font size, and work on a large range of devices.
- to remove the scrollbar, we can do this:
body { margin: 0; padding: 1rem; }
To make the user have to at least select one button, we can do it in a very simple way:
ratingButtons.forEach((e) => { e.addEventListener("click", () => { ratingNumber.innerText = e.innerText; btnSubmit.addEventListener("click", () => { mainContainer.style.display = "none"; thankYouContainer.style.display = ""; }) }) })
The rest is great!
I hope it helps... 👍
Marked as helpful0@khuranamananPosted about 2 years ago@AdrianoEscarabote Thank You, Adriano, for the feedback. I have made the changes you suggested. 😊
1 - @harsh-mohite-09Posted about 2 years ago
Hey Manan, nice work.
It will be even better if user gets an alert if he tries to submit without selecting. Try implementing that.
Design is very close to accurate. Kudos!
0@khuranamananPosted about 2 years ago@harsh-mohite-09 Thanks, Harsh. Will try the alert.
0 - @funupuluPosted about 2 years ago
Hi dude,
do you know that half of your JS script is commentded out?
//Adding Event listner on all rating buttons // ratingButtons.forEach((e)=>{ // e.addEventListener("click", ()=>{ // ratingNumber.innerText = e.innerText; // }) // })
// btnSubmit.addEventListener("click", ()=>{ // mainContainer.style.display = "none"; // thankYouContainer.style.display = ""; // })
0@khuranamananPosted about 2 years ago@funupulu Yes, the commented-out code is the same as the executed one. Just the two lines have been combined ( for submit button to work only when rating button is clicked.)
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