Slider

Sliders

To add a slider widget to your page, start with an input with a new HTML5 type="range" attribute. Specify the value (current value), min and max attribute values to configure the slider. The framework will parse these attributes to configure the slider.

As you drag the slider, the input will update and vice-versa so they are always in sync so you can submit the slider value with form in a simple way. Set the for attribute of the label to match the ID of the input so they are semantically associated and wrap them in a div with the data-role="fieldcontain" attribute to group them.


<div data-role="fieldcontain">
	<label for="slider">Input slider:</label>
 	<input type="range" name="slider" id="slider" value="0" min="0" max="100"  />
</div>

An example of a slider and input is displayed like this:

By setting the min and maxattributes you can configure the allowable number range of the slider track. The value of the input is used to configure the starting position of the handle and the value populated in the text input.

The slider with a min of 500, max of 5,000 and initial value of 2,500