Javascript validation | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Javascript validation

I have this code and it still passes validation without an @ symbol function validateEmail()       {          var emailID = document.myForm.EMail.value;          atpos = emailID.indexOf("@");          dotpos = emailID.lastIndexOf(".");                   if (atpos < 1 || ( dotpos - atpos < 2 ))          {             alert("Please enter correct email ID")             document.myForm.EMail.focus() ;             return false;          }          return( true );       }

15th Jun 2018, 4:44 AM
David CHAMPION
David CHAMPION - avatar
2 Answers
+ 1
Hi David! This seems like a statement. Did you have a question about this? -- Janning.
16th Jun 2018, 11:14 AM
Janning
Janning - avatar
0
yea why is it still allowing validation without the @
17th Jun 2018, 2:42 PM
David CHAMPION
David CHAMPION - avatar