×

应用validate验证表单中两次密码的DEMO

作者:andy0012020.08.20来源:Web前端之家浏览:7162评论:0
关键词:jsvalidate

分享下应用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: "*请输入手机号码"
                    }
                }
            });

您的支持是我们创作的动力!
温馨提示:本文作者系 ,经Web前端之家编辑修改或补充,转载请注明出处和本文链接:
https://jiangweishan.com/article/js20200820a1.html

网友评论文明上网理性发言 已有0人参与

发表评论: