Easy Tutorial
❮ Prop Meter Min Jsref Obj Date ❯

disabled Attribute for Textarea

Textarea Object


Example

Disable a textarea:

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

Definition and Usage

The disabled attribute sets or returns whether the textarea should be disabled.

A disabled input element is unusable and un-clickable. The disabled attribute can be set to keep a user from using the textarea until some other condition has been met (like selecting a checkbox, etc.).

Tip: If you want the content of the textarea to be read-only, you can use the readOnly attribute.


Browser Support

Attribute Chrome Edge Firefox Safari Opera
disabled Yes Yes Yes Yes Yes

Syntax

Set the disabled attribute:

textareaObject.disabled = true|false

Return the disabled attribute:

textareaObject.disabled

Attribute Values

Value Description
true false Sets whether the textarea should be disabled. true - Disables the textarea. false - Default. Does not disable the textarea.

Technical Details

| Return Value: | A Boolean, returns whether the textarea should be disabled. |


More Examples

Check if the textarea element is disabled:

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

Disable and enable the textarea element:

function disableTxt() {
  document.getElementById("myTextarea").disabled = true;
}

function undisableTxt() {
  document.getElementById("myTextarea").disabled = false;
}

Textarea Object

❮ Prop Meter Min Jsref Obj Date ❯