Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Input Search Object

HTML DOM Input Search Object


Input Search Object

The Input Search object is new in HTML5.

The Input Search object represents an HTML element using type="search" .

Accessing the Input Search Object

You can use the getElementById() function to access the one using the type="search" attribute element:

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

Try it

Tip: You can also access the Input Color object through a form'sElementcollection to access the Input Search object.

Creating the Input Search Object

You can use the document.createElement() method to create the one using the type="search" attribute element:

var x = document.createElement("INPUT");

x.setAttribute("type", "search");

Try it

Input Search Object Properties

Property Description
autocomplete Sets or returns the value of the autocomplete attribute of the search field
autofocus Sets or returns whether the search field automatically gets 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 reference to the form that uses the search field
list Returns a reference to the datalist containing the search field
maxLength Sets or returns the value of the maxLength attribute of the search field
name Sets or returns the value of the name attribute of the search field
pattern Sets or returns the value of the pattern attribute 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 a required field in the form
size Sets or returns the value of the size attribute 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 the standard property and Events.


Related Articles

HTML Tutorial: HTML Forms

HTML Reference Manual: HTML tag

HTML Reference Manual: HTML type Attribute