isEmail Function


/ Published in: JavaScript
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.