html input range step as an array of values

前端 未结 4 695
太阳男子
太阳男子 2020-12-05 22:17

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 spe

4条回答
  •  感动是毒
    2020-12-05 22:37

    Karmacon's answer works just fine, but don't forget to add the attribute aria-valuetext to the input element. It will help screen readers read out the correct value.

    MDN provides a good example: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_slider_role#Example_2_Text_Values

提交回复
热议问题