The readonly attribute specifies that the input field is read only (cannot be changed):
HTML file: | Displayed by browser: |
---|---|
<form>
First name: <br /><input type="text" name="firstname" value="John" readonly> <br /> <br />Last name: <br /><input type="text" name="lastname"> </form> |
The readonly attribute does not need a value. It is the same as writing readonly="readonly".