Jquery Validate custom error message location

后端 未结 7 1747
一个人的身影
一个人的身影 2021-01-30 16:35

This looks very simply, but I can\'t figure it out. I\'m using the jquery validate plugin. I\'m trying to validate and

7条回答
  •  南方客
    南方客 (楼主)
    2021-01-30 17:10

    JQUERY FORM VALIDATION CUSTOM ERROR MESSAGE

    Demo & example

    $(document).ready(function(){
      $("#registration").validate({
        // Specify validation rules
        rules: {
          firstname: "required",
          lastname: "required",
          email: {
            required: true,
            email: true
          },      
          phone: {
            required: true,
            digits: true,
            minlength: 10,
            maxlength: 10,
          },
          password: {
            required: true,
            minlength: 5,
          }
        },
        messages: {
          firstname: {
          required: "Please enter first name",
         },      
         lastname: {
          required: "Please enter last name",
         },     
         phone: {
          required: "Please enter phone number",
          digits: "Please enter valid phone number",
          minlength: "Phone number field accept only 10 digits",
          maxlength: "Phone number field accept only 10 digits",
         },     
         email: {
          required: "Please enter email address",
          email: "Please enter a valid email address.",
         },
        },
      
      });
    });
    
    
    
    jQuery Form Validation Using validator()
     
    
    
    
    
    

    Registration






提交回复
热议问题