HTML Input Attributes | html attributes
ThischapterdescribesthedifferentattributesfortheHTMLelement.ThevalueAttributeTheinputvalueattributespecifiesaninitialvalueforaninputfield:ExampleInputfieldswithinitial(default)values:
TryitYourself»[1]ThereadonlyAtt...This chapter describes the different attributes for the HTML <input> element.
The value AttributeThe input value attribute specifies an initial value for an input field:
ExampleInput fields with initial (default) values:
<form> <label for="fname">First name:</label><br> <input type="text" id="fname" name="fname" value="John"><br> <label for="lname">Last name:</label><br> <input type="text" id="lname" name="lname" value="Doe"></form>
Try it Yourself »[1] The readonly AttributeThe input readonly attribute specifies that an input field is read-only.
A read-only input field cannot be modified (however, a user can tab to it, highlight it, and copy the text from it).
The value of a read-only input field will be sent when submitting the form!
ExampleA read-only input field:
<form> <label for="fname">...