readonly vs disabled
What is the difference between readonly and disabled?
A readonly field is submitted and can be focused. A disabled field is skipped on submit and can't be focused. Both skip validation.
| Behaviour | readonly | disabled |
|---|---|---|
| Submitted with the form | Yes | No |
| Can be focused and selected or copied | Yes | No |
| In the tab order | Yes | No |
Validation like required | Skipped | Skipped |
| Works on | Text-like, number and date inputs and <textarea>. NOT <select>, checkbox, radio or file. | Every form control, plus <fieldset> |
| CSS pseudo-class | :read-only | :disabled |
Sources: WHATWG HTML Standard: constructing the entry list · MDN: HTML attribute readonly · MDN: HTML attribute disabled




