Design comparison
Solution retrospective
My first challenge using JS. I appreciate any feedback.
Community feedback
- @AdrianoEscarabotePosted almost 2 years ago
Hello Kinga, how are you? I truly loved your project's outcome, however I have some advice that I hope you'll find useful:
To make the submit button work only when the user selects a number, we can do this:
for (let i = 0; i < rating.length; i++) { rating[i].addEventListener('click', function () { a.textContent = rating[i].textContent + ' '; submitBtn.addEventListener('click', function () { ratingSection.style.display = 'none'; thankSection.style.display = 'grid'; }); }); }
The remainder is excellent.
I hope it's useful. 👍
Marked as helpful1@K-MuzslayPosted almost 2 years ago@AdrianoEscarabote Thank you very much for your suggestion to make my function better :) /to be honest I didn't think about that problem, my bad/ I tried to fix it before closely looking at your solution. I used an if statement for checking the length of the textContent, but after looking at yours, yes that is unnecessary in this case. :)
Thank you again :)
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