使用jQuery进行电子邮件验证
问题描述:
我是jQuery的新手,想知道如何使用它来验证电子邮件地址.
I'm new to jQuery and was wondering how to use it to validate email addresses.
答
您可以为此使用常规的旧javascript:
You can use regular old javascript for that:
function isEmail(email) {
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return regex.test(email);
}