Tuesday, 27 August 2013

Can HTML5 datalist differentiate value and option text?

Can HTML5 datalist differentiate value and option text?

The list attribute / datalist element of HTML5 forms shows a dropdown menu
of choices one can pick from, edit, and even type in some text. All this
can be achieved at once with a clean and powerful code:
<input list="states">
<datalist id="states">
<option value="One">
<option value="Two">
</datalist>
However, how to make such a form send a value which is different from the
option text, as in the usual select / option (below)?
<select>
<option value="1">One</option>
<option value="2">Two</option>
</select>

No comments:

Post a Comment