Validators
required
- Type:
true
- Input types: input, select, checbox, radio button.
- Falsy: if the element is empty (text input) or unchecked (radio/checkbox) or if select option isn't selected (also select option with
disabled
attr). - Example: Link
EXAMPLE
minLength
- Type:
number
- Falsy: if the input string value is more then validator param.
- Valid example:
param <= input.value.length
- Example: Link
EXAMPLE
maxLength
- Type:
number
- Falsy: if the input string value is less then validator param.
- Valid example:
input.value.length <= param
- Example: Link
EXAMPLE
min
- Type:
number
- Falsy: if the input value as number is less then validator param as number.
- Valid example:
param <= parseInt(input.value)
- Example: Link
EXAMPLE
max
- Type:
number
- Falsy: if the input value as number is more then validator param as number.
- Valid example:
parseInt(input.value) <= param
- Example: Link
EXAMPLE
digits
- Type:
number
- Falsy: if the input value contain not digits.
- Valid example:
parseInt(input.value) <= param
- Example: Link
EXAMPLE
range
- Type:
[number1, number2]
- Valid example:
number1 <= value && value <= number2
- Details: Value must be more then first validator param and less then second validator param (comparison as numbers)
- Example: Link
EXAMPLE
email
- Type:
true
- Falsy: Return false if the value isn't a valid email address.
- Example: Link
EXAMPLE
url
- Type:
true
- Falsy: Return false if the value isn't a valid url address.
- Example: Link
EXAMPLE
number
- Type:
true
- Falsy: Returns true if the value contains a valid decimal number.
EXAMPLE
equalTo
- Type:
css selector
- Falsy: Requires the element to be the same as another one
EXAMPLE