HTML <input> type Attribute
Example
<input type="search" id="srch" name="srch">
Meaning
A single-line text field for entering search strings.
Line-breaks are automatically removed from the input value. May include a delete icon in supporting browsers that can be used to clear the field. Displays a search icon instead of enter key on some devices with dynamic keypads.
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="search">
XHTML: <input type="search" />
Advertisement