HTML <input type="search">
Example
Define a search field (like a site search, or Google search):
<label for="gsearch">Search Google:</label>
<input type="search"
id="gsearch" name="gsearch">
Try it Yourself »
Definition and Usage
The <input type="search">
defines a text field for entering a search string.
Note: Remember to set a name for the search field, otherwise nothing will be submitted. The most common name for search inputs is q.
Tip: Always add the <label>
tag
for best accessibility practices!
Browser Support
The numbers in the table specify the first browser version that fully supports the element.
Attribute | |||||
---|---|---|---|---|---|
type="search" | 26.0 | 10.0 | 4.0 | 5.1 | 12.1 |
Syntax
<input type="search">