1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to do email vaildation in javascript?

Discussion in 'HTML & JavaScript' started by Ruriko, May 22, 2009.

  1. Ruriko

    Ruriko Power Member

    Joined:
    May 4, 2008
    Messages:
    525
    Likes Received:
    12
    How do you create in javascript to do email vaildation? to check

    must contain 1 @
    must contain 1 letter before the @
    must contain 1 letter after the @
    must not contain spaces, slash, colon, comma or semicolon

    if the any of the rules are wrong it will alert the user saying "Invalid Email"
     
  2. _Austin

    _Austin Junior Member

    Joined:
    Apr 9, 2009
    Messages:
    147
    Likes Received:
    39
  3. grazor

    grazor Registered Member

    Joined:
    Apr 14, 2009
    Messages:
    57
    Likes Received:
    19
    Just make sure that you check if javascript is enabled in the first place, and always validate everything server side as well. Javascript validation should only be used to add user-friendliness, (no page refresh) but don't depend on it.
     
  4. lord

    lord Junior Member

    Joined:
    Jan 21, 2009
    Messages:
    176
    Likes Received:
    251
    1 point after @ etc. be careful for the ending after the point must be 2,3 or 4 chars