Input Range valueProperty

Input Range 对象参考手册Input Range Object

Example

Change the value of the slider control:

document.getElementById("myRange").value = "75";

Try it Yourself »

Definition and Usage

The value property is used to set or return the value of the value attribute of the slider control.

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


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the value property.

Note:Internet Explorer 9 and earlier IE versions do not support HTML <input> elements with the type="range" attribute.


Syntax

Return the value property:

rangeObject.value

Set the value property:

rangeObject.value=number

Property Values

Value Description
number Describes the initial (default) value of the slider control. If not specified, the default value is "50".

Technical Details

Return value: A string, representing a number


More Examples

Example

Get the value of the slider control:

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

Try it Yourself »


Related Pages

HTML Reference Manual:HTML <input> value Attribute


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