Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Dec 2009
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Email validation with javascript

    This are my codes..


    var add = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    var email = form.txtEmail.value;
    if (add.test(email) = false)
    {
    alert("Please enter a valid email.");
    return false;
    }
    return true;
    }


    bt it wun work.. pls help..

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    See, what you've done there is... well, several things.

    Firstly, you've dropped a question containing no reference to any known javascript frameworks, into a forum for javascript frameworks.

    Secondly, you've posted a tantalising snippet of code; an appetite-whetter, the javascript equivalent of a saucy flash of leg, but no indication of how, where or when this code runs, or what you're expecting it to do when it does.

    And finally, you've signed off with that most helpful of requests for aid: "It don't work".

    I'd suggest a brief trip to the posting guidelines, followed by a revisitation of your request. Try to include some as much helpful information as you can. This may include, but is not necessarily limited to:
    • A link to where we can see the thing running.
    • An expanded code snippet, illustrating how the code is being called and what is being sent to it when it is.
    • A summary of what you'd like to happen, and a description of what actually happens.
    • Some punctuation.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •