Textarea disabledProperty

Textarea 对象参考手册Textarea Object


Example

Example

Disable a text field:

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

Try it yourself »


Definition and Usage

The disabled property sets or returns whether a text field should be disabled.

Disabled input elements are neither usable nor clickable. The disabled attribute can be set until some other condition is met (such as selecting a checkbox, etc.).

Tip:If you want the content of the text field to be read-only, you can use thereadOnlyproperty.



Browser Support

Property
disabled Yes Yes Yes Yes Yes

Syntax

To set the disabled property:

textareaObject.disabled = true|false

To return the disabled property:

textareaObject.disabled


Property Values

Value Description
true|false

Sets whether the textarea text field should be disabled.

  • true - Disables the text field.
  • false - Default. Does not disable the text field.


Technical Details

Return Value: A Boolean value, returning whether the text field should be disabled.

More Examples

Example

Check whether a textarea element is disabled:

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

Try it yourself »

Example

Disable and un-disable a textarea element:

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

Try it yourself »

Textarea 对象参考手册Textarea Object

Other Extensions