Using the input Element for Text Input
Description
If you set the type
attribute to text
for input
element,
the browser will display a single-line text box.
The following list summarizes the attributes that are available for text input element type.
- dirname - Controls text directionality.
- list - Specifies the id of a datalist element that provides values for this element.
- maxlength - Specifies the maximum number of characters that the user can enter into the text box.
- pattern - Specifies a regular expression pattern for the purposes of input validation.
- placeholder - Specifies a hint to the user as to the kind of input that you expect.
- readonly - If present, this attribute makes the text box read-only.
- required - Specifies that the user must enter a value for the purposes of input validation.
- size - Specifies the width of the element in the number of characters that are visible in the text box.
- value - Specifies the initial value for the text box.