Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML DOM Input Search object


May 06, 2021 JavaScript with HTML DOM Reference book


Table of contents


HTML DOM Input Search object


Input Search object

Input Search objects are new to HTML5.

The Input Search object represents an HTML-lt;input> element that uses type"search".

Access the Input Search object

You can use the getElementById() function to access the elements that use the type-"search" property:

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

Tip: You can also access the Input Search object through the form's collection of elements.

Create an Input Search object

You can use the document.createElement() method to create an element that uses the type-"search" property:

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

Input Search object properties

Property describe
autocomplete Set or return to the autocomplete property value of the Search field
autofocus Set or return to the Search field, whether the focus is automatically obtained after the page is loaded.
defaultValue Set or return the default value of the Search field
disabled Set or return to the Search field available
form Returns a form reference to using the Search field
list Returns a DataList reference that contains the Search field
maxLength Set or return the MaxLength property value of the Search field
name Set or return the name property value of the Search field
pattern Set or return the pattern property value of the Search field
placeholder Set or return to the PlaceHolder property value of the Search field
readOnly Set or return to the Search field Read only
required Set or return to the Search field to be required in the form
size Set or return the size property value of the Search field
step Set or return STEP attribute values for the Search field
type Returns the type element type of the Search field
value Set or return the value attribute value of the Search field

Standard properties and events

Input Search objects also support standard properties and events.


Related articles

HTML tutorial: HTML forms

HTML Reference Manual: HTML slt;input.gt; Tags

HTML Reference Manual: HTML slt;input> type property