@AdrianoEscarabote
Posted
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 helpful
@K-Muzslay
Posted
@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 :)