Design a site like this with
Get started

Function to validate email in javascript

This regular expression will not verify if the particular email id exists or not. Instead, this regex is to validate the format of email id

In jquery

var ValidateEmail= function (email)
    var regexp = new RegExp('^[^\s@]+@[^\s@]+\.[^\s@]+$'); 
    var check = $(email).val();
    if (!regexp.test(check)) {
        alert('Invalid e-mail!Please enter the e-mail ID in correct format');
        $('#EmailID').css('border-color', 'red');
        return false;
        $('#EmailID').css('border-color', 'green');
        return true;


@Html.TextBox("EmailID", null, new { @class = "form-control text-box", @onchange = "ValidateEmail(this)" })


This regex is versatile as it allows the all-important international characters while not disturbing the basic something@something.something format.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a free website or blog at

Up ↑

%d bloggers like this: