mvc里的表单juery 验证   

  <script type="text/javascript">
    $().ready(function() {
        $("#frmReg").validate(
        {
            errorElement: "reg",  /*
插件会自动在文本框后生成一个label,取标记名为'reg',这样可以用 reg.success{}来控制样式,记住reg.success之间不要留空格*/
            success: function(label) {
                label.text(" ").addClass("success");
            },
            rules: {
                username: {
                    required: true,
                    minlength: 2,
                    maxlength:16
                },
                email:{required:true,email:true},
                password: {
                    required: true,
                    minlength: 6,
                    maxlength:16
                },
                confirmPassword:{required:true, equalTo: "#password"},
                validate:{required:true}
              
            }

        }
        );
    });
</script>


html代码:
<form action="/Account/Register" method="post" />
</div>
</form>

<!--v:3.2-->

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-09
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2021-05-04
  • 2021-07-19
相关资源
相似解决方案