HTML <textarea> readonlyAttribute

HTML textarea 标签参考手册HTML <textarea> Tag

Examples

A read-only text area:

<textarea readonly>
At example.com you will learn how to build websites. We provide the most comprehensive web technology tutorials.
</textarea>

Try it yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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 or copy its content.

The readonly attribute can be set until certain conditions are met (such as selecting a checkbox), then the user can use the text area again. After that, JavaScript can be used to remove the readonly attribute's value 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 <textarea readonly="readonly">.


Syntax

<textarea readonly>


HTML textarea 标签参考手册HTML <textarea> Tag Other Extensions