HTML DOM Input Search Object

Input Search object

The Input Search object is a new object in HTML5.

The Input Search object represents the HTML <input type="search"> element.

Note:Internet Explorer 9 (and earlier versions) or Safari does not support the <input type="search"> element.

Access the Input Search object

You can access the <search> element by using getElementById():

var x = document.getElementById("mySearch");

Try It Yourself

Create Input Search Object

You can create a <search> element by using the document.createElement() method:

var x = document.createElement("INPUT");
x.setAttribute("type", "search");

Try It Yourself

Input Search object properties

Attributes Description
autocomplete Set or return the autocomplete attribute value of the Search field.
autofocus Set or return whether the Search field should automatically focus after page loading.
defaultValue Set or return the default value of the Search field.
disabled Set or return whether the Search field is disabled.
form Return a reference to the form containing the Search field.
list Return a reference to the datalist containing the Search field.
maxLength Set or return the maxLength attribute value of the search field.
name Set or return the name attribute value of the Search field.
pattern Set or return the pattern attribute value of the Search field.
placeholder Set or return the placeholder attribute value of the Search field.
readOnly Set or return whether the Search field is read-only.
required Set or return whether the Search field must be filled out before submitting the form.
size Set or return the size attribute value of the Search field.
step Set or return the step attribute value of the Search field.
type Return the form element type of the Search field.
value Set or return the value of the Search field's value attribute.

Input Search object methods

Methods Description
blur() Remove focus from the search field.
focus() Focus on the search field.
select() to select the content of the search text field.

standard attributes and events

Input Search object supports standardAttributesandEvents.

Related Pages

HTML Tutorial:HTML Form

HTML Reference Manual:HTML <input> Tag

HTML Reference Manual:HTML <input> type Attribute