分享下应用validate验证表单中两次密码的DEMO。为了去做一些简单的落地页,有时候还是用下jQuery。
$("#aspnetForm").validate({ rules: { txtName: { required: true }, txtTrueName: { required: true }, txtPass: { required: true, minlength: 3 }, txtTwoPass: { required: true, minlength: 3, equalTo: "#txtPass" }, txtEmail: { required: true, email: true }, txtAddress: { required: true }, txtPhone: { required: true } }, messages: { txtName: { required: "*请输入用户名" }, txtTrueName: { required: "*请输入姓名" }, txtPass: { required: "*请输入密码", minlength: "*密码不能小于3个字符" }, txtTwoPass: { required: "*请输入确认密码", minlength: "*密码不能小于3个字符", equalTo: "*请再次输入相同的值" }, txtEmail: { required: "*请输入邮箱", email: "*请输入正确的邮箱格式" }, txtAddress: { required: "*请输入地址" }, txtPhone: { required: "*请输入手机号码" } } });
网友评论文明上网理性发言 已有0人参与
发表评论: