Latest web development tutorials

HTML DOM Input Search value property

Input Search Object Reference Input Search Object

Examples

Change the value of the search field:

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

try it"

Definition and Usage

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

value attribute describes the value entered by the user or a script or a default value entered value.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support attribute value


grammar

Returns the value property:

searchObject .value

Set the value property:

searchObject .value=text

Property Value

描述
text 描述了搜索字段的初始化(默认)值。

technical details

return value: Value string representing the search fields


More examples

Examples

Gets the value of the search field:

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

try it"


Related Pages

HTML Reference Manual: HTML <the INPUT> value The property


Input Search Object Reference Input Search Object