HTML DOM Input Search value property
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
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