The readOnly property sets or returns whether a text field is read-only, or not.
A read-only field cannot be modified. However, a user can tab to it, highlight it, and copy the text from it.
Tip: To prevent the user from interacting with the field, use the disabled property instead.
Set the readOnly property:
Return the readOnly property:
The readOnly property is supported in all major browsers.
Set a text field to be read-only:
Your message has been sent to W3Schools.