Latest web development tutorials

HTML textarea readonly attribute

HTML textarea tag Reference Manual HTML <textarea> tag

Examples

A read-only text area:

<textarea readonly>
在 w3big.com 你将学会如何制作网站。我们提供了最全的 web 技术教程。
</textarea>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the readonly attribute.


Definition and Usage

readonly attribute is a Boolean attribute.

readonly attribute specifies the text area is read-only.

In a read-only text area, the content can not be modified, but the user can toggle through the tab key to the control, select or copy its contents.

You can set readonly property until certain conditions are met (such as selecting a check box), before resuming the use of users of the text area. You can then use JavaScript to remove the value of the readonly attribute to make the text area editable.


Differences between HTML 4.01 and HTML5

no.


Differences between HTML and XHTML

In XHTML, prohibit attribute minimization, readonly attribute must be defined as <textarea readonly = "readonly">.


grammar

<textarea readonly>


HTML textarea tag Reference Manual HTML <textarea> tag