Input Range value attribute
Definition and Usage
value
Sets or returns the value of the value attribute of the slider control.
The HTML value attribute specifies the default value or the value entered by the user (or the value set by the script).
See also:
HTML Reference Manual:HTML <input> value-Attribut
Example
Example 1
Change the value of the slider control:
document.getElementById("myRange").value = "75";
Example 2
Get the value of the slider control:
var x = document.getElementById("myRange").value;
Example 3
An example showing the difference between the defaultValue and value attributes:
var x = document.getElementById("myRange"); var defaultVal = x.defaultValue; var currentVal = x.value;
Syntax
Return the value attribute:
rangeObject.value
Set the value attribute:
rangeObject.value = number
Attributswert
Wert | Beschreibung |
---|---|
number | Legt den Wert des Schiebereglers fest. Wenn kein Wert festgelegt wird, ist der Standardwert "50". |
Technische Details
Rückgabewert: | Zahl, die den Wert des Schiebereglers darstellt. |
---|
Browserunterstützung
Die in der Tabelle angegebenen Zahlen beziehen sich auf die erste vollständige Unterstützung der Eigenschaft durch den Browser.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Unterstützung | 10.0 | Unterstützung | Unterstützung | Unterstützung |