You are here: Reference > HTML > tags > input:search

input:search element

Browser support:
Creates a search field. It contains a single-line text input control with a search history dropdown list.
All searches in this field are saved into the search history under the category specified by the autosave attribute. If the autosave attribute of two different search tags contain identical values, the searches belonging to these fields are saved under the same category of the history.
Use a unique category name (for example, the domain where the site is) to avoid the mixing of categories. If the autosave attribute is not defined, then the history dropdown list is invisible, and the searches are not saved into the history.
The results attribute specifies how many elements are visible in the dropdown list of the search history.
This control is one of the form controls.
The contents of the control can be submitted to a server if the following conditions are met:
  • A form element must contain the search control.
  • The action attribute of the container form must be set to the URL of the server.
  • The name attribute of the search control must be specified and non-empty.
When the container form is submitted, the name and the text content of the control are sent as a name/value pair.
If you want to see the HTML tags by categories, please visit this page.
This element cannot have a closing tag.
JavaScript page for this element: input:search.

Possible members:

Attributes
Events
Styles
Pseudos
accessKey
Sets an access key to an element.
autosave
Specifies the name of a category in the search history.
class
Sets the style class or classes that belong to the element.
contentEditable
Sets whether the contents of the object are editable.
dir
Sets the text direction as related to the lang attribute.
DISABLED
Sets the state of an object for user interaction.
id
Sets a unique identifier for the object.
INCREMENTAL
Specifies what type of user actions fire the onsearch event.
lang
Specifies the language of the element.
name
Sets the name of a form control that affects the contents of the message submitted to the server.
placeholder
Sets the initial value of the text field.
READONLY
Sets whether the contents of the element are changeable.
results
Specifies how many elements are visible in the dropdown list of the search history.
size
Specifies the width of a control, in characters.
style
Sets an inline style associated with an element.
tabIndex
Specifies the tabbing order for keyboard navigation using the TAB key.
title
Specifies a tooltip for an element.
type
Sets the type of the input element.
value
Specifies the initial value for a control element.

Example HTML code 1:

This example illustrates the use of the search input element:
<form method="post" action="#URL#">
    Search for: <input type="search" name="search" autosave="www.dottoro.com" results="10" />
    <br /><br />
    <input type="submit" value="Search" />
</form>
Did you find this example helpful? yes no

Related pages:

External links:

User Contributed Comments

Post Content

Post Content