Design comparison
SolutionDesign
Solution retrospective
What are you most proud of, and what would you do differently next time?
- creating all the logic in Javascript to do the seletion of the buttons dynamically using the forEach method.
- Using javascript to add the logic to make the modal panel show up
// Show the modal on submit button click
mySubmitBtn.addEventListener('click', (e) => {
e.preventDefault(); // Prevent form submission
// 🚩Ensure a rating has been selected before proceeding
if (selectedRating) {
// Update the modal content with the selected rating
myRatingSelection.innerHTML = `You selected ${selectedRating} out of 5`; // this
// Hide the rating panel and show the modal
myRatingPanel.style.display = 'none';
myModal.style.display = 'flex';
} else {
// 🚩don't forget to add an alert if the user didn't select a rating
alert('Please select a rating before submitting.');
}
});
What challenges did you encounter, and how did you overcome them?
same as above
What specific areas of your project would you like help with?none
Community feedback
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