HTML <input> type Attribute
Example
<input type="text" name="fname">
Meaning
The default value. provides single-line text field.
Line-breaks are automatically removed from the input value.
Additional Attributes
- list: The id of the
<datalist>element that contains the optional pre-defined autocomplete options. - maxlength:The maximum number of characters the input should accept.
- minlength:The minimum number of characters long the input can be and still be considered valid.
- pattern:A regular expression the input's contents must match in order to be valid.
- placeholder:An exemplar value to display in the input field whenever it is empty.
- readonly:A Boolean attribute indicating whether or not the contents of the input should be read-only.
- size:A number indicating how many characters wide the input field should be.
- spellcheck: Controls whether or not to enable spell checking for the input field, or if the default spell checking configuration should be used.
Standard Syntax
HTML: <input type="text">
XHTML: <input type="text" />
Advertisement