@KrishangSharma
Posted
Hello there! There a few things I'd like to point out by looking at your code, 1). You're doing things in kind of a messy way. What I mean is, there is an easier way to do what is asked. Rather than targeting each rating number individually, I'd recommend giving them all a common class name and then using 'document.querySelectorAll' and then loop over the buttons for retrieving the number. The loop itself is a bit tough just because you chose to add an array in between, while actually it was not needed at all.
2). For the Thank you part, I'd rather add it in the HTML itself and then hide it using CSS, and then upon clicking the submit btn, I'd toggle the classes between the two cards, this way you won't need to code the HTML in your JS file. For the places where you need the value from JS, you can leave them empty, then target them in your JS file, and then populate them with 'innerHTML'
If it all seems a bit complex, you can have a look at my solution :)
Hope this helps!
Marked as helpful
@Thiha007
Posted
@KrishangSharma Thanks. That's really helpful.