The readonly attribute is a Boolean on textual <input> types and <textarea>. When present, the user cannot edit the control — but it stays focusable, and its value is still submitted with the form.
Contrast with disabled: disabled controls typically cannot focus and are left out of submission. Use readonly for confirmed values (order ID, username) that must still post to the server.
Baseline · Widely available.
Not deprecated. Boolean: presence means on. Write readonly, not readonly="false".
Do not combine with required.
Readonly controls do not participate in constraint validation. MDN: required is not permitted with readonly.
Syntax
HTML Syntax
syntax.html
<input type="text" readonly>
<textarea readonly>…</textarea>
In JavaScript: input.readOnly = true (capital O in the IDL property).
Values
Attribute Values
Boolean — no value list. Behavior vs related states:
Display multi-line text that cannot be edited in the UI.
HTML
<label for="terms">Terms (read only)</label>
<textarea id="terms" name="terms" rows="4" readonly>
These terms are shown for review and will be submitted with the form.
</textarea>
Most mistakes are using the wrong control type or confusing readonly with disabled.
types
Not for checkbox, radio, file, etc.
Only textual inputs and textarea. Use disabled (or redesign) for other controls.
boolean
readonly="false" still means readonly
Remove the attribute or set readOnly = false in script.
required
Skip required on readonly fields
They do not join constraint validation; pairing is invalid per MDN guidance.
script
Scripts can still change the value
Readonly blocks user editing, not programmatic updates.
css
Style with :read-only
Use the :read-only / :read-write pseudo-classes for visual feedback.
Compatibility
Browser Support
readonly is an HTML Boolean attribute on form controls. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
readonly
Supported everywhere modern forms work. Prefer readonly over disabled when the value must still submit.
98%Global support (approx.)
Google ChromeYes
Full support
Mozilla FirefoxYes
Full support
Apple SafariYes
Full support
Microsoft EdgeYes
Full support
OperaYes
Full support
Samsung InternetYes
Full support
Internet ExplorerYes
Supported
readonlyWidely supported
Bottom line: Safe to use on text-like inputs and textarea. Remember: focusable + submitted, unlike disabled.
Remember
Key Takeaways
Role: non-editable, still focusable and submitted.
Not disabled — disabled skips focus and submit.
Textual inputs + textarea only.
Avoid pairing with required.
One line:readonly locks editing but keeps the field in focus order and form data.
Frequently Asked Questions
It is a Boolean attribute on textual inputs and textarea. When present, the user cannot edit the control, but it can still receive focus and its value is submitted with the form.
Readonly fields stay focusable and are submitted. Disabled fields usually look inactive, cannot receive focus, and are omitted from form submission.
Text-like inputs (text, search, tel, url, email, password, date types, number, and similar) and textarea. It does not apply to checkbox, radio, file, range, color, hidden, or button types.
No meaningful effect. MDN notes required is not permitted together with readonly, and readonly controls do not participate in constraint validation.
Yes. Scripts can set the value or toggle input.readOnly / remove the attribute. Users cannot edit through the UI while readonly is set.
No. It is a Baseline widely available Boolean form attribute.