I\'m new to jQuery and was wondering how to use it to validate email addresses.
Another simple and complete option:
function IsEmail(email) {
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return regex.test(email);
}
$("#ValidMail").click(function () {
$('span', '#ClasSpan').empty().remove();
if (IsEmail($("#Email").val())) {
//aqui mi sentencia
}
else {
$('#ClasSpan').append('Please enter a valid email');
$('#Email').keypress(function () {
$('span', '#itemspan').empty().remove();
});
}
});