Textarea disabledProperty
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.
|
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 »
Other Extensions
Textarea Object