Textarea required property
Example
Check whether the textarea text area must be filled before submitting the form:
var
x
=
document
.
getElementById
(
"
myTextarea
"
)
.
required
;
Try it »
Definition and Usage
The required property is used to set or return whether the textarea element must be filled before submitting the form.
Browser support
| property | |||||
|---|---|---|---|---|---|
| required | Yes | 10.0 | Yes | Not supported | Yes |
Syntax
Return the required attribute:
textareaObject.required
Set the required attribute:
textareaObject.required = true|false
Attribute values
| Value | Description |
|---|---|
| true|false |
Specifies whether the textarea element must be filled before the form is submitted. |
Technical Details
| Return value: | Boolean, returns true if the textarea element must be filled before form submission, otherwise returns false. |
|---|
More examples
Example
Set the textarea element to be required before form submission:
document
.
getElementById
(
"
myTextarea
"
)
.
required
=
true
;
Try it »
The Textarea object