0

After going through some answers on SO this is my code:

   $(".check").keyup(function () {
        var VAL = $(this).val();

      var email = new RegExp('^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$');

        if (email.test(VAL)) {
            alert('Great, you entered an E-Mail-address');
        }
    });

<input type="text" class="check"   />
<input type="text" class="check"   />

But for some reason it doesn't work.

3
  • 1
    You probably need some regex tutorial... Commented Sep 10, 2015 at 7:54
  • This will fail to match a lot of valid email addresses, see: en.wikipedia.org/wiki/Email_address#Examples Commented Sep 10, 2015 at 8:18
  • E-mail addresses usually contain lower-case characters. Commented Sep 10, 2015 at 8:26

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.