In this section, we will learn what the readonly attribute is in HTML <textarea> element and how to use it.
What is readonly Attribute in HTML <textarea> Tag?
The readonly attribute is used in HTML <textarea> element to make that field read-only!
This means you won’t be able to use the field to insert data anymore.
The readonly attribute is mainly used when you want to give information to users in a <textarea> field instead of letting users to use it for adding data!
HTML readonly Attribute in <textarea> Tag Syntax:
<textarea readonly> </textarea>
<textarea> Tag readonly Attribute Values
The readonly attribute doesn’t need a value! We only need to put this attribute in the opening tag of HTML <textarea> element and after that, the field becomes read-only.
Example: using readonly attribute in HTML <textarea> tag
See the Pen using readonly attribute in HTML <textarea> tag by Omid Dehghan (@odehghan) on CodePen.