Design comparison
SolutionDesign
Solution retrospective
Open to suggestion for email validation structure.
Community feedback
- @fazzaamiarsoPosted about 2 years ago
Hi Simios! Nice work!
To validate a string containing something, you can use contains().
const inputVal = input.value; const isValidEmail = inputVal.contains("@"); if(isValidEmail){ error.classList.add('hidden'); } else { error.classList.remove('hidden'); }
I hope it helps! Cheers!
Marked as helpful0@FernandoChurrosPosted about 2 years agoGood afternoon, @fazzaamiarso
Writing this way I get the error:
Uncaught TypeError: inputVal.contains is not a function
0@fazzaamiarsoPosted about 2 years ago@FernandoChurros whoops my bad. I meant .includes()
1
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