Textarea disabled property
Example
Example
Disable a text box:
document
.
getElementById
(
"
myTextarea
"
)
.
disabled
=
true
;
Try it »
Definition and Usage
The disabled property can set or return whether the text box should be disabled.
A disabled input element is neither usable nor clickable. The disabled attribute can be set until some other condition is met (such as selecting a checkbox, etc.).
**Note:** If you want the content of the text box to be read-only, you can use readOnly attribute.
Browser support
| property | |||||
|---|---|---|---|---|---|
| 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 |
Set whether the textarea text box should be disabled. |
Technical Details
| Return value: | A boolean, returning whether the text box should be disabled. |
|---|
More examples
Example
Check whether the textarea element is disabled:
var
x
=
document
.
getElementById
(
"
myTextarea
"
)
.
disabled
;
Try it »
Example
Disable and re-enable the textarea element:
function
disableTxt
(
)
{
document
.
getElementById
(
"
myTextarea
"
)
.
disabled
=
true
;
}
function
undisableTxt
(
)
{
document
.
getElementById
(
"
myTextarea
"
)
.
disabled
=
false
;
}
Try it »
The Textarea object