jquery-validate 表单较验

阅读更多

 

 (1)


 

(2)

$().ready(function() {
    $("#form1").validate({
        rules:
        {
          userNo: {
           required: true,
           maxlength: 50
          },
          email:{
            required: true,
            email: true,
            equalTo: "#userNo"
          },
          phone:{
            required: true,
            minlength: 5
          },
          creDate:{
            required: true,
            minlength: 5
          }
        },
        messages:
        {
         userNo: {
           required: "请输入用户编号",
           maxlength: "长度不能大于50"
          },
          email:
          {
            required: "请输入Email地址",
            email: "请输入正确的email地址",
            equalTo: "email与用户编号不一致"
          },
          phone:
          {
            required: "请输入电话",
            //minlength: jQuery.format("密码不能小于{0}个字符")
            minlength: "密码不能小于5个字符"
          },
          creDate:
          {
            required: "请输入日期"
          }
        }
    });
  });

 

(3) 表单较验

 var isValid = $('#form1').valid();

 

 

  • jquery-validate.rar (26.8 KB)
  • 下载次数: 0

你可能感兴趣的:(jquery)