Textarea disabled attribute
Definition and Usage
disabled
Attribute sets or returns whether the text area should be disabled.
Disabled elements are not available and cannot be clicked. By default, disabled elements are usually displayed in gray in the browser.
This property reflects the HTML disabled attribute.
Tip:If you want the content of the text area to be read-only, use readOnly Attribute.
See also:
HTML Reference Manual:HTML <textarea> disabled Attribute
Example
Example 1
Disable the text area:
document.getElementById("myTextarea").disabled = true;
Example 2
Check if the text area is disabled:
var x = document.getElementById("myTextarea").disabled;
Example 3
Disable and enable the text area:
function disableTxt() { document.getElementById("myTextarea").disabled = true; } function undisableTxt() { document.getElementById("myTextarea").disabled = false; }
Syntax
Return the disabled attribute:
textareaObject.disabled
Set the disabled attribute:
textareaObject.disabled = true|false
attribute value
value | description |
---|---|
true|false |
Specifies whether the text area should be disabled
|
Technical Details
Return value: | Boolean value, returns if the text area is disabled true ; otherwise return false . |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |