Input Search valueProperty
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
![]()
![]()
![]()
![]()
![]()
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 Object Other Extensions