@elaineleung
Posted
Hi Ash, about the validation (I'm guessing you mean checking whether a number is clicked), one of the ways to do this is to use a simple conditional, like this:
// this is the variable with the selected number
let selected;
form.addEventListener("submit", (event) => {
if (selected) {
// display thank you card
}
})
You can also use not undefined
:
form.addEventListener("submit", (event) => {
if (selected !== undefined) {
// display thank you card
}
})
Here's a CodePen for this challenge that you can check out in action: https://codepen.io/elaineleung/pen/poLZrqK
Hope this helps a bit!
Marked as helpful
@ashkanmus
Posted
Hi @elaineleung, thanks for taking the time to check my work; I appreciate your kind help!
@elaineleung
Posted
@ashkanmus Glad to help, Ash 😊
By the way, I forgot to wish you a warm welcome to the Frontend Mentor community, and well done completing your first challenge here. Looking forward to more!