Google News
logo
jQuery - Interview Questions
How to Valid an email using JQuery?
To valid email id using JQuery create a separate function ValidEmail(). Pass the email id as a parameter. Using Regex we can valid the email id. Example shown below.
 
function ValidEmail(EmailID) {
var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
if (filter.test(EmailID)) {
return true;
}
else {
return false;
}
}
Advertisement