标签:utf-8 radio use require word error validate err body
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="js/jquery-1.8.3.js" ></script>
<script type="text/javascript" src="js/jquery.validate.min.js" ></script>
<script type="text/javascript" src="js/messages_zh.js" ></script>
<style>
label.error{
color: red;
}
</style>
<script>
$(function(){
$("#checkform").validate({
rules:{
user:{
required:true,
minlength:6
},
password:{
required:true,
digits:true,
minlength:6
},
repassword:{
required:true,
digits:true,
minlength:6
},
email:{
required:true,
email:true
},
sex:{
required:true
}
},
messages:{
user:{
required:"用户名不能为空",
minlength:"用户名不能少于6位"
},
password:{
required:"密码不能为空",
digits:"密码必须为数字",
minlength:"密码不能低于6位"
},
repassword:{
required:"密码不能为空",
digits:"密码必须为数字",
minlength:"密码不能低于6位"
},
email:{
required:"邮箱必填",
email:"邮箱格式不正确"
},
sex:{
required:"性别必填"
}
},
});
});
</script>
</head>
<body>
<form action="#" id="checkform" method="post" name="regform" onsubmit="return checkform()">
用户名: <input type="text" name="user"value="" /><br />
密码: <input type="password" name="password" id="password" value="" /><br />
重复密码: <input type="repassword" name="repassword" id="repassword" value="" /><br />
邮箱: <input type="email" name="email" id="email" value="" /><br />
性别: <input type="radio" name="sex" value="" />男
<input type="radio" name="sex" value="" />女<br />
<input type="submit" value="注册" />
</form>
</body>
</html>
标签:utf-8 radio use require word error validate err body
原文地址:https://www.cnblogs.com/xuaima/p/10479481.html