Input Range value Property

❮ Input Range Object

Example

Change the value of a slider control:

document.getElementById("myRange").value = "75";
Try it Yourself »

Description

The value property sets or returns the value of the value attribute of a slider control.

The value attribute specifies the default value OR the value a user types in (or a value set by a script).


Browser Support

Property
value Yes 10.0 Yes Yes Yes

Syntax

Return the value property:

rangeObject.value

Set the value property:

rangeObject.value = number

Property Values

Value Description
number Specifies the value of the slider control. If the value is not specified, the default value is "50"


Technical Details

Return Value: A String, representing a number that represents the value of the slider control

More Examples

Example

Get the value of a slider control:

var x = document.getElementById("myRange").value;
Try it Yourself »

Example

An example that shows the difference between the defaultValue and value property:

var x = document.getElementById("myRange");
var defaultVal = x.defaultValue;
var currentVal = x.value;
Try it Yourself »

Related Pages

HTML reference: HTML <input> value attribute


❮ Input Range Object
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.