(name.value === '') {
messages.push('Please your Name is required')
}
if (meg.value.length <= 30) {
messages.push('Your message is too short, please be eleborate')
}
if (!email.value.match(mailformat)) {
messages.push('Please enter a correct email address')
errorElement.innerText = messages.join(', ')
}
else{
//send a message here
}
}
Good day everyone
Please what's the best way for me to write this code?
I know i can use a single
if
state with && condition but i want to validate each input which returns different messages for each then fire another block of code which sends an email at the
else{}
block
Please have Mercy on my noob-ness🙏😁
Fixed it Dumb me Could ve just used else if🤦
Обсуждают сегодня