Home > Web Front-end > JS Tutorial > Guide to using jquery.validate Part 2_jquery

Guide to using jquery.validate Part 2_jquery

WBOY
Release: 2016-05-16 18:24:14
Original
1088 people have browsed it

Plugin methodsName Type
validate( options ) Returns: Validator
Validate the selected FORM
valid( ) Returns: Boolean
Check whether the validation passes
rules( ) Returns: Options
Return Validation rules for elements
rules( "add", rules) Returns: Options
Add validation rules
rules( "remove", rules ) Returns: Options
Remove validation rules
removeAttrs( attributes ) Returns: Options
Remove special attributes and return them
Custom selectors
Name Type
:blank Returns: Array
Filter with no value
:filled Returns: Array
Filter with value
:unchecked Returns: Array
Filter for unselected elements
Utilities
Name Type
jQuery.format( template, argument , argumentN... ) Returns: String
Replace {n} in the template with parameters.
The Validatorvalidate method returns a Validator object, which has many methods that allow you to trigger the validation process or change the content of the form.
The following is just a list of commonly used ones.
form( ) Returns: Boolean
Verify whether the form returns success or failure
element( element ) Returns: Boolean
Verify whether a single element is successful or failed
resetForm( ) Returns: undefined
Restore the previously verified FORM to the original one before verification Status
showErrors( errors ) Returns: undefined
Show specific error messages
built-in Validation methods
Name Type
setDefaults( defaults ) Returns: undefined
Change the default settings
addMethod( name, method, message ) Returns: undefined
Adds a new validation method. Must include name, a JAVASCRIPT method and a default message
addClassRules( name, rules ) Returns: undefined
Add combination validation type
addClassRules( rules) Returns: undefined
Add combination validation type
built-in Validation methodsName Type
required( ) Returns: Boolean
Required validation element
required ( dependency-expression ) Returns: Boolean
Required element depends on the result of expression.
required( dependency-callback ) Returns: Boolean
Required element depends on the result of callback function.
remote ( url ) Returns: Boolean
Request remote verification. The url is usually a remote call method
minlength( length) Returns: Boolean
Set the minimum length
maxlength( length) Returns: Boolean
Set the maximum length
rangelength( range) Returns: Boolean
Set a length range [min,max]
min( value) Returns: Boolean
Set the minimum value.
max( value) Returns: Boolean
Set the maximum value.
range( range ) Returns: Boolean
Set the range of the value
email( ) Returns: Boolean
Verify the email format
url( ) Returns: Boolean
Verify the connection format
date( ) Returns : Boolean
Verify date format (similar to the format of 30/30/2008, do not verify date accuracy, only verify the format)
dateISO( ) Returns: Boolean
Develop ISO type date format
dateDE( ) Returns: Boolean
Verify German date format (29.04.1994 or 1.1.2006)
number( ) Returns: Boolean
Verify decimal numbers (including decimals)
numberDE( ) Returns: Boolean
Makes the element require a decimal number with german format.
digits( ) Returns: Boolean
Verify integer
creditcard( ) Returns: Boolean
Verify credit card number
accept( extension ) Returns: Boolean
Verify strings with the same suffix name
equalTo( other ) Returns: Boolean
Verify whether the contents of the two input boxes are the same
For other APIs, please refer to the customization part of the next chapter.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template