Dofactory.com
Dofactory.com

HTML <input> type="range"

The <input> tag with a type="range" attribute creates a range input control.

This control is a slider where a value is selected in a range, between a minimum and a maximum value.

Example

#

An <input> element of type range.
The slider accepts values between 0 and 100 in increments of 10.



The value is 30 PSI
<form oninput="result.value = slider.value">
  <label>Select pressure</label><br/>
  <input type="range" id="slider" 
         min="0" max="100" step="10" value="30"> <br />
  
  The value is <output name="result" for="slider">30</output> PSI
</form>

Using input type="range"

The <input type="range"> creates a range input control.

The default range is 0 to 100, but this can be changed with min and max attributes.

The step attribute is used to define the interval step between the values.

The range initial value is specified with the value attribute.


Syntax

<input type="range">

Browser support

Here is when type="range" support started for each browser:

Chrome
4.0 Jan 2010
Firefox
23.0 Aug 2013
IE/Edge
10.0 Sep 2012
Opera
10.1 Jun 2009
Safari
3.1 Mar 2008

You may also like

 Back to <input>

Author: Jack Poorte
Published: Jun 20 2021
Last Reviewed: Sep 30 2023


What's your favorite/least favorite part of Dofactory?


Guides