datalist for range/color inputs offer some default choices

Chrome started to support datalist for input[type=text] in Chrome 20. datalist helps developers provide recommended values, while allowing users the liberty to write arbitrary values at the same time. Beginning with Chrome 23, you can use datalist for input[type=range] and input[type=color] as well!


datalist for input[type=range] introduces the ability for developers to show indicators beside the slider as shown below:

Range datalist.
<input type="range" value="0" min="0" max="100" list="numbers" />
<datalist id="numbers">

Moving the slider thumb on the input snaps to each of the ticks so that users can easily adjust to those values.


input[type=color] is already supported in Chrome and Opera. Users can pick arbitrary color without any help from JavaScript plugins.

By adding datalist to input[type=color], users can now pick a color from developer selected color swatches as well as choosing arbitrary color from a color picker by themselves.

Color datalist.
<input type="color" value="#000000" list="colors" />
<datalist id="colors">

Note that datalist for input[type=color] only accepts the hex color values (ex. #ff0000) and values such as #f00 or red won’t work.

To see these new features in action, visit a demo page.