The readonly
attribute on an input element specifies that the element is read-only which means the element is non-editable.
Readonly input elements are included in form submission.
Elements that accept this attribute includes <input> and <textarea>.
A readonly attribute on an <input> element.
The text field is not editable, but its value is included during form submission.
<form action="/tutorial/action.html">
<label for="title">Title</label><br />
<input type="text" id="title" name="title"
value="Of Mice and Men" readonly><br /><br />
<input type="submit">
</form>
For additional details see our HTML input readonly Reference.
The readonly
attribute specifies that an input element is read-only.
An element with readonly enabled cannot be modified, but it will send its data when submitted.
<tagname readonly>
The following input elements accept the readonly
attribute.
Elements | Description | |
---|---|---|
<input> | Specifies an input field -- see example above | |
<textarea> | Creates a multi-line text input field. |
A <textarea> tag with a readonly attribute.
The textarea is not editable but its value will be submitted.
<form action="/tutorial/action.html">
<label for="summary">Summary</label><br />
<textarea name="summary"
rows="5" cols="60" readonly>
Starting with her idyllic life on a sprawling plantation,
the book traces her survival through the tragic history of
the South during the Civil War and Reconstruction, and her
tangled love affairs with Ashley Wilkes and Rhett Butler.
</textarea><br /><br />
<input type="submit">
</form>
For additional details see our HTML textarea readonly Reference.
Here is when readonly
support started for each browser:
![]() Chrome
|
1.0 | Sep 2008 |
![]() Firefox
|
1.0 | Sep 2002 |
![]() IE/Edge
|
1.0 | Aug 1995 |
![]() Opera
|
1.0 | Jan 2006 |
![]() Safari
|
1.0 | Jan 2003 |