The value Attribute
The value attribute specifies the initial value for an input field.
<form action=""> First name:<br> <input type="text" name="firstname" value="John"> </form>
The readonly Attribute:
The read-only attribute specifies that the input field is read-only.
<form action=""> First name:<br> <input type="text" name="firstname" value="John" readonly> </form>
The disabled Attribute: The disabled attribute specifies that the input field is disabled. A disabled input field is unusable and un-clickable, and its value will not be sent when submitting the form.
<form action=""> First name:<br> <input type="text" name="firstname" value="John" disabled> </form>
The size Attribute: The size attribute specifies the size (in characters) for the input field.
<form action=""> First name:<br> <input type="text" name="firstname" value="John" size="40"> </form>
The maxlength Attribute: The maxlength attribute specifies the maximum allowed length for the input field.
<form action=""> First name:<br> <input type="text" name="firstname" maxlength="10"> </form>
HTML5 Attributes
HTML5 added the following attributes for <input>:
- autocomplete
- autofocus
- form
- formaction
- formenctype
- formmethod
- formnovalidate
- formtarget
- height and width
- list
- min and max
- multiple
- pattern (regexp)
- placeholder
- required
- step