HTML DOM Input Range Object

Input Range Object

The Input Range Object is a new object in HTML5.

The Input Range Object represents the HTML <input type="range"> element.

Note:Internet Explorer 9 and earlier versions do not support the <input type="range"> element.

Access the Input Range Object

You can access the <input type="range"> element by using getElementById():

var x = document.getElementById("myRange");

Try it yourself

Tip:You can also iterate over the elements collection to access the Input Range object.

Create Input Range object

You can create an <input type="range"> element by using the document.createElement() method:

var x = document.createElement("INPUT");
x.setAttribute("type", "range");

Try it yourself

Input Range object properties

Properties Description
autocomplete Set or return the autocomplete attribute value of the slider control.
autofocus Set or return whether the slider control should automatically focus after the page is loaded.
defaultValue Set or return the default value of the slider control.
disabled Set or return whether the slider control is disabled.
form Return a reference to the form containing the slider control.
list Return a reference to the datalist containing the slider control.
max Set or return the max attribute value of the slider control.
min Set or return the min attribute value of the slider control.
name Set or return the name attribute value of the slider control.
step Set or return the step attribute value of the slider control.
type Return the form element type of the slider control.
value Set or return the value of the slider control's value attribute.

Input Range object methods

Method Description
stepDown() Decrement the value of the slider control by the specified number.
stepUp() Increment the value of the slider control by the specified number.

Standard attributes and events

The Input Range object supports standardsPropertiesandEvents.

Related pages

HTML Tutorial:HTML Forms

HTML Reference Manual:HTML <input> tag

HTML Reference Manual:HTML <input> type attribute