代码实例如下: <!DOCTYPE html>admin管理员组文章数量:1573370
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.51texiao/" />
<title>蚂蚁部落</title>
<script type="text/javascript" src="mytest/jQuery/jquery-1.8.3.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#bt").click(function(){
if($("#email1").val()=="")
{
alert("邮箱不能为空");
return false;
}
var email=$("#email1").val();
if(!email.match(/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/))
{
alert("格式不正确!请重新输入");
$("#email1").focus();
}
})
})
</script>
</head>
<body>
<form action="#">
<input type="text" id="email1">
<input type="button" value="提交" id="bt">
</form>
</body>
</html>
转载于:https://wwwblogs/momox/p/5090790.html
版权声明:本文标题:jQuery邮箱格式验证代码 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1727747744a1128012.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论