validateTextarea
The validateTextarea function validates a specified textarea input field. It checks if the textarea meets the validation criteria defined in the options and returns an ErrorMessageInterface.
Works in: HTML5, React JS
| Parameter | Type | Default | Description |
|---|---|---|---|
textareaField | HTMLTextAreaElement | undefined | The textarea input field to validate. |
options | object | {} | Optional settings for validation such as custom error messages. |
Usage
Example: Validate a Textarea Input
// Using with a textarea input element
const textareaElement = document.querySelector('textarea');
const result = nfsfu234FormValidation.validateTextarea(textareaElement, {
message: 'Please provide a valid input.'
});
console.log(result);See also
Last updated on