<input> - search
HTML DOM Input Search object
Input Search object
The Input Search object is new to HTML5.
The Input Search object represents an HTML <input> element with type="search".
Access the Input Search object
You can use the getElementById() function to access <input> elements with the type="search" attribute:
var x = document.getElementById("mySearch");
Tip: You can also access the Input Search object through the form's elements collection.
Create an Input Search object
You can use the document.createElement() method to create an <input> element with the type="search" attribute:
var x = document.createElement("INPUT");
x.setAttribute("type", "search");
Input Search Object Attributes
Attribute | Description |
---|---|
autocomplete | Sets or returns the autocomplete attribute value for the search field |
autofocus | Sets or returns whether the search field automatically gets the focus after the page loads |
defaultValue | Sets or returns the default value of the search field |
disabled | Sets or returns whether the search field is available |
form | Returns a form reference that uses the search field |
list | Returns a form reference a that uses the search field |
maxLength | Sets or returns the maxLength attribute value for the search field |
name | Sets or returns the value of the name attribute of the search field |
pattern | Sets or returns the pattern attribute value of the search field |
placeholder | Sets or returns the value of the placeholder attribute of the search field |
readOnly | Sets or returns whether the search field is read-only |
required | Sets or returns whether the search field is required in the form |
size | Sets or returns the size attribute value of the search field |
step | Sets or returns the value of the step attribute of the search field |
type | Returns the form element type of the search field |
value | Sets or returns the value of the value attribute of the search field |
Standard Properties and Events
The Input Search object also supports standard properties and events .
Related articles
HTML Tutorial: HTML Forms
HTML Reference Manual: HTML <input> Tag
HTML Reference Manual: HTML <input> type attribute