HTML
Example
A read-only text area:
Try it »
Browser support





All major browsers support the readonly attribute.
Definition and Usage
The readonly attribute is a boolean attribute.
The readonly attribute specifies that the text area is read-only.
In a read-only text area, the content cannot be modified, but the user can tab to the control, select, and copy its content.
You can set the readonly attribute until certain conditions are met (such as selecting a checkbox), then restore the user's use of the text area. Then, you can use JavaScript to remove the value of the readonly attribute to make the text area editable.
Differences between HTML 4.01 and HTML5
none.
Differences between HTML and XHTML
In XHTML, attribute minimization is forbidden, and the readonly attribute must be defined as
Syntax
HTML