<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>JQuery表单验证插件jQuery.validate.js</title>
<style type="text/css">
/******/
form.cmxform label.error, label.error {
color: red;
font-style: italic;
}
</style>
</head>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<body>
<form class="cmxform" id="commentForm" method="get" action="">
<fieldset>
<legend>注册账号</legend>
<p>
<label for="cusername">用户名</label>
<input id="username" name="username" />
<p>
<label for="cemail">邮箱</label>
<input id="email" name="email" />
</p>
<p>
<label for="cpassword">密码</label>
<input type="password" id="password" name="password" value="" />
</p>
<p>
<label for="cconfirm_password">确认密码</label>
<input type="password" id="confirm_password" name="confirm_password" value="" />
</p>
<p>
<input class="submit" type="submit" value="提交"/>
</p>
</fieldset>
</form>
</body>
</html>
<script type="text/javascript" >
$.validator.setDefaults({
submitHandler: function() {
alert("已经提交!");
}
});
$().ready(function() {
$("#commentForm").validate({
rules: {
username: {
required:true,
minlength:2
},
email: {
required: true,
email: true
},
password: {
required: true,
minlength: 6
},
confirm_password: {
required: true,
minlength: 6,
equalTo: "#password"
}
},
messages: {
username: {
required:"用户名必填",
minlength:"至少2个字符"
},
email:"请输入一个邮件地址",
password: {
required: "请输入密码",
minlength: "密码不能少于6个字符"
},
confirm_password: {
required: "请输入确认密码",
minlength: "确认密码不能少于6个字符",
equalTo: "密码输入不一致"
}
}
});
});
</script>
jQuery验证控件 Validation Plugin - v1.14.0汉化及附带案例
4星 · 超过85%的资源 需积分: 50 78 浏览量
2015-08-27
21:48:36
上传
评论 1
收藏 39KB RAR 举报
youyo0u380
- 粉丝: 5
- 资源: 9
最新资源
- 2013-2022vc运行命令库
- probleme.exe
- 基于python完成对csv文件的读取并且通过flask框架显示
- 基于SpringBoot的“体质测试数据分析及可视化”的设计与实现.zip
- c语言-c语言编程基础之leetcode题解第21题合并两个有序链表.zip
- 快速开发API服务的框架
- c语言-c语言编程基础之leetcode题解第20题有效的括号.zip
- c语言-c语言编程基础之leetcode题解第19题删除链表的倒数第N个结点.zip
- c语言-c语言编程基础之leetcode题解第17题电话号码的字母组合.zip
- c语言-c语言编程基础之leetcode题解第16题最接近的三数之和.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈