digits validator
Check if the input contains only digits
Options
Using with form field
Name | HTML attribute | Type | Description |
---|
message | data-fv-digits___message | String | The error message |
Using the ES6 module
import { digits } from '/vendors/@form-validation/cjs/validator-digits';
const result = digits().validate({
value: ...,
options: {
message: ...,
},
});
Using the npm package
- Install the validator package:
$ npm install @form-validation/validator-digits
- Use the
digits
validator:
import { digits } from '@form-validation/validator-digits';
const result = digits().validate({
value: ...,
options: {
message: ...,
},
});
See also
Changelog