HTML <textarea> readonly Attribute
Example
<form action="action.php">
<textarea readonly name="textareaText">Hello world!</textarea>
<input type="submit" value="Submit">
</form>
Meaning
The readonly attribute prevents the form control’s value from being changed.
Form controls with this attribute set might receive focus from the user but should not permit the user to modify the value.
Because it receives focus, a readonly form control will be part of the form’s tabbing order.
Finally, the control’s value will be sent on form submission.
Under XHTML, the value of the readonly attribute should be set to readonly="readonly".
Standard Syntax
HTML: <textarea readonly>...</textarea>
XHTML: <textarea readonly="readonly">...</textarea>
Advertisement
Attribute Values
| Value | Description |
|---|---|
| readonly | This is a boolean attribute, the presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value. |