Regular Expressipn For Multiple Emails using Jquery

Category: JQUERY Comments: No comments

Sometimes we need to validate multiple email id’s using regular expression through JQuery
example is given below. Below example validating multiple email address on button click.

$(document).ready(function () {
var regExp = /^([\w+-.%]+@[\w-.]+\.[A-Za-z]{2,4},?)+$/; //Regular Expression
$(“input[id$=SendInvites]“).click(function () {
var valTag = $(“input[id$=txtEmailAddress]“).val();
if (!regExp.test(valTag)) {
alert(‘Invalid email address.’);
return false;
}

});
});

Leave a Reply

Your email address will not be published. Required fields are marked *

*

HTML tags are not allowed.