EN
HTML - range input
6 points
In this article, we would like to show you how to create and use range input element in HTML.
Quick solution:
xxxxxxxxxx
1
<label>
2
<span>Range: </span>
3
<input type="range" name="example-range" min="0" max="10" />
4
</label>
Screenshot:

In this example, we use the input element's type="range"
attribute to create range input element.
Additionally, we specify the following range input attributes:
min
- minimum value,max
- maximum value,step
- specifies the size of each movement (increment or decrement) of the slider control.
xxxxxxxxxx
1
2
<html>
3
<body>
4
<script>
5
6
function handleInput(input) {
7
console.log('Value: ' + input.value);
8
}
9
10
</script>
11
<form>
12
<label>
13
<span>Range: </span>
14
<input type="range" name="example-range" min="0" max="10" step="2" oninput="handleInput(this)" />
15
</label>
16
</form>
17
</body>
18
</html>