HTML <input> readonly Attribute

❮ HTML <input> tag


<input type="text" id="fname" name="fname" value="John" readonly>


The readonly attribute prevents the form control’s value from being changed.

It might receive focus from the user but not permit the user to modify the value.

readonly form control will be part of the form’s tabbing order. The control’s value will be sent on form submission.

Standard Syntax

HTML: <input readonly>

XHTML: <input readonly/>

Browser Support

Note: Readonly inputs of type datetime-local, date, month, and week can still be edited by pressing the Up or Down arrow keys on the keyboard while the input is focused.


Attribute Values

Value Description
readonly This is a boolean attribute, the presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value.
❮ HTML <input> tag