Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Step parameter for input type of range

Tags:

Is it possible to specify a decimal for a step parameter within the range element? According to a few articles I've read, including one on Nettuts, this should be possible. This does not appear to be working in any browsers. I've tried Chrome, Safari, and mobile Safari. Am I misunderstanding simple here, or is this just not supported quite yet?

 <input id='something' type='range' min='0' max='20' step='.25' value='5' /> 
like image 789
Joe Longstreet Avatar asked Dec 03 '11 16:12

Joe Longstreet


People also ask

What is step in input range?

The step attribute specifies the interval between legal numbers in an <input> element. Example: if step="3" , legal numbers could be -3, 0, 3, 6, etc. Tip: The step attribute can be used together with the max and min attributes to create a range of legal values.

How do you use range input type?

The <input type="range"> defines a control for entering a number whose exact value is not important (like a slider control). Default range is 0 to 100. However, you can set restrictions on what numbers are accepted with the attributes below. Tip: Always add the <label> tag for best accessibility practices!

What is the default step and max value for the input type called range?

The default is 0. The value won't be greater than max . The default is 100. The value will be a multiple of step .


1 Answers

http://jsfiddle.net/Df57B/

Check out this demo it is possible to give steps in decimal.

<input type="range" name="points" min="1" max="10"         step="0.25" onchange="alert(this.value)"/> 

Your mistake take is that you gave .25 instead of 0.25.

like image 93
aWebDeveloper Avatar answered Oct 25 '22 08:10

aWebDeveloper