Input Search valueProperty

Input Search 对象参考手册Input Search Object

Example

Modify the value of the search field:

document.getElementById("mySearch").value = "Favorite Cars";

Try it Yourself »

Definition and Usage

The value property is used to set or return the value of the value attribute of the search field.

The value property describes the value entered by the user, or the default value, or the value entered by a script.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the value property.


Syntax

Return the value property:

searchObject.value

Set the value property:

searchObject.value=text

Property Values

Value Description
text Describes the initial (default) value of the search field.

Technical Details

Return value: A string, representing the value of the search field.


More Examples

Example

Get the value of the search field:

var x = document.getElementById("myRange").value;
xThe output is:
Food

Try it Yourself »


Related Pages

HTML Reference Manual:HTML <input> value Attribute


Input Search 对象参考手册Input Search Object Other Extensions