(1)required:true Required fields (2)remote:"check.php" but 🎜>(4)url:true You must enter the URL in the correct format (5)date:true You must enter the date in the correct format (6)dateISO:true You must enter the date (ISO) in the correct format, for example: 2009-06-23, 1998/01/22 Only verify the format, not the validity (7)number:true You must enter legal numbers (negative numbers, decimals) (8)digits:true You must enter an integer (9)creditcard: You must enter a legal credit card number (10)equalTo:"#field" The input value must be the same as #field (11)accept: Enter a string with a legal suffix ( Suffix of the uploaded file) (12)maxlength:5 Enter a string with a maximum length of 5 (Chinese characters count as one character) (13)minlength:10 Enter a string with a minimum length of 10 (Chinese characters count as one character) ) (14)rangelength:[5,10] Input a string whose length must be between 5 and 10") (Chinese characters count as one character) (15)range:[5,10] Input value Must be between 5 and 10 (16)max:5 The input value cannot be greater than 5 (17)min:10 The input value cannot be less than 10
required: "This field is required. ", remote: "Please fix this field.", email: "Please enter a valid email address.", url: "Please enter a valid URL.", date: " Please enter a valid date.", dateISO: "Please enter a valid date (ISO).", dateDE: "Bitte geben Sie ein gumeltiges Datum ein.", number: "Please enter a valid number.", numberDE: "Bitte geben Sie eine Nummer ein.", digits: "Please enter only digits", creditcard: "Please enter a valid credit card number.", equalTo: "Please enter the same value again.", accept: "Please enter a value with a valid extension.", maxlength: $.validator.format("Please enter no more than { 0} characters."), minlength: $.validator.format("Please enter at least {0} characters."), rangelength: $.validator.format("Please enter a value between {0 } and {1} characters long."), range: $.validator.format("Please enter a value between {0} and {1}."), max: $.validator.format( "Please enter a value less than or equal to {0}."), min: $.validator.format("Please enter a value greater than or equal to {0}.") },
If you need to modify it, save the following js code as: messages_cn.js and quote it on the page:
jQuery.extend(jQuery.validator.messages, { required : "Required field", remote: "Please correct this field", email: "Please enter a correct email format", url: "Please enter a legal URL", date: "Please enter a legal date", dateISO: "Please enter a legal date (ISO).", number: "Please enter a legal number", digits: "Only integers can be entered ", creditcard: "Please enter a legal credit card number", equalTo: "Please enter the same value again", accept: "Please enter a string with a legal suffix", maxlength: jQuery.validator.format("Please enter a string with a length of at least {0}"), minlength: jQuery.validator.format("Please enter a string with a length of at least {0}") , rangelength: jQuery.validator.format("Please enter a string with a length between {0} and {1}"), range: jQuery.validator.format("Please enter a length between A value between {0} and {1}"), max: jQuery.validator.format("Please enter a value up to {0}"), min: jQuery.validator.format ("Please enter a minimum value of {0}") });
Usage method 1. Write the verification rules into the control
The above code means: If the firstname field does not fill in any content, it will prompt: Please enter the content. So, if the length of the filled-in content is less than 5, how should the user be prompted to write? Please look at the code below:
input.error defines the style of the input control
label.error defines the style of the error message
As shown below:
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn