HTML DOM Input Range Object


Input Range Object

The Input Range object is new in HTML5.

The Input Range object represents an HTML <input> element with the type="range" attribute.

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

Access an Input Range Object

You can use the getElementById() function to access an <input> element with the type="range" attribute:

var x = document.getElementById("myRange"); Try it Yourself

Tip:You can also use the form'selementscollection to access the Input Range object.

Create an Input Range Object

You can use the document.createElement() method to create an <input> element with the type="range" attribute:

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

Input Range Object Properties

Property Description
autocomplete Sets or returns the autocomplete attribute value of the slider control.
autofocus Sets or returns whether the slider control automatically gets focus after the page loads.
defaultValue Sets or returns the default value of the slider control.
disabled Sets or returns whether the slider control is enabled.
form Returns a reference to the form that contains the slider control.
list Returns a reference to the datalist that contains the slider control.
max Sets or returns the max attribute value of the slider control.
min Sets or returns the min attribute value of the slider control.
name Sets or returns the name attribute value of the slider control.
step Sets or returns the step attribute value of the slider control.
type Returns the type of form element the slider control is.
value Sets or returns the value attribute value of the slider control.

Standard Properties and Events

The Input Range object also supports standardpropertiesandevents。


Related Articles

HTML Tutorial:HTML Forms

HTML Reference Manual:HTML <input> Tag

HTML Reference Manual:HTML <input> type Attribute

Other Extensions