Easy Tutorial
❮ Prop Checkbox Form Jsref Constructor Date ❯

required Attribute for Textarea

Textarea Object


Example

Check if the textarea must be filled out before submitting the form:

var x = document.getElementById("myTextarea").required;

Definition and Usage

The required attribute is used to set or return whether the textarea element must be filled out before submitting the form.


Browser Support

Attribute Chrome IE Firefox Safari Opera
required Yes 10.0 Yes No 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 out before submitting the form. true - The textarea element must be filled out before submitting the form.<br>false - Default. The textarea element does not need to be filled out before submitting the form.

Technical Details

| Return Value: | Boolean, returns true if the textarea element must be filled out before form submission, otherwise returns false. |


More Examples

Example

Set the textarea element to be required before form submission:

document.getElementById("myTextarea").required = true;

Textarea Object

❮ Prop Checkbox Form Jsref Constructor Date ❯