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 Property.
See also:
HTML Reference Manual:Attribut disabled de <textarea> HTML
Example
Example 1
Disable text area:
document.getElementById("myTextarea").disabled = true;
Example 2
Check if the text area is disabled:
var x = document.getElementById("myTextarea").disabled;
Example 3
Enable and disable 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 |
Détermine si le champ de texte doit être désactivé.
|
Détails techniques
Valeur de retour : | Valeur booléenne, renvoie si le champ de texte est désactivé true sinon retourne false . |
---|
Compatibilité des navigateurs
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |