interactive rating used JS

Solution retrospective
JS script work, but I didn't figure it out how to make it work both, submit form and add class without reload the page..
Please log in to post a comment
Log in with GitHubCommunity feedback
- @Ahmed96Mah
Hello Alexei,
If you mean that you want the user to be able to submit another review without needing to reload the page, then you should set a timeout function to your thankU function (located at line 14 of script.js) as follows:
// notice that you should write const or let before the function name const thankU = () => { let selected = document.querySelector('input[type=radio]:checked'); thankUCard.classList.add('active'); starResult.innerText = selected.value; setTimeout( () => { // add a setTimeout function to your code // Then, remove the 'active' class from the card thankUCard.classList.toggle('active'); }, 2500); // This sets a delay of 2500 millisecond or 2.5 seconds return false; }
So, after the card appears, it will stay there for 2.5 seconds and then disappear which will allow the user to submit another rating.
Hope this helps. If you have another question, don't hesitate to ask.
Have a nice day :)
Join 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