html输入范围步骤作为值的数组 [英] html input range step as an array of values
问题描述
我第一次玩弄了 input type = range
,理想情况下我想将步骤值设置为一个值数组。我查看了规范,我发现了datalist的可能性,但它接收的数据列表仅用于范围内的高亮值,可以这么说,但不能将值设置在范围内。
I've been playing around with the input type=range
for the first time, and ideally I'd like to set the step value to an array of values. I looked over the spec and I see the possibility for a datalist but it seams the data list is only used for highlight values in a range, so to speak, but not setting the values in the range.
所以,像这样的东西(理想情况下没有jQuery插件等):
So, something like this (ideally without a jQuery plugin, etc.):
<input type="range" min="1" max="100" value="0" step="1,3,5,10,20">
推荐答案
根据 W3C规范,step的值可以是any或正浮动点数。就是这样。
According to the W3C spec, the values for step can be "any" or a positive floating-point number. That's it.
step属性(如果指定)必须具有一个值为
的有效浮点数解析为
大于零的数字,或者必须具有与字符串any匹配的ASCII不区分大小写的
的值。
The step attribute, if specified, must either have a value that is a valid floating-point number that parses to a number that is greater than zero, or must have a value that is an ASCII case-insensitive match for the string "any".
这篇关于html输入范围步骤作为值的数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!