Posted By

alberomo on 08/22/11


Tagged

javascript DOM validation manual Jeremy Keith


Versions (?)

isEmail Function


 / Published in: JavaScript
 

Check if user has intruded a real email address. Return true (real email) or false (fake email). Arguments: Element from a form. From book Dom Scripting by Jeremy Keith

  1. function isEmail(field) {
  2. if (field.value.indexOf("@") == -1 || field.value.indexOf(".") == -1) {
  3. return false;
  4. } else {
  5. return true;
  6. }
  7. }

Report this snippet  

You need to login to post a comment.