HTML and CSS Reference
In-Depth Information
The color input type
<input type=color> allows the user to input a colour value via a
picker. So far, it's only implemented on the BlackBerry ( Figure 3.9 ).
<input type=color> on the
New attributes
As well as new input types, the input element has several new
attributes to specify behaviour and constraints: autocomplete ,
min , max , multiple , pattern , and step . There's also a new attri-
bute, list , that hooks up with a new element to allow a new
data input method.
The list attribute
The <datalist> is reminiscent of a select box, but allows users to
enter their own text if they don't want to choose one of the pre-
defined options. The list is contained in a new <datalist> element,
the id of which is referenced in the value of the list attribute:
<input id=form-person-title type=text list=mylist>
<datalist id=mylist>
<option label=Mr value=Mr>
<option label=Ms value=Ms>
<option label=Prof value=”Mad Professor”>
<datalist> has no rendering of its own, but instead shows up
as values in a select-like fi eld.
The previous example uses type=text to allow freeform input,
but you can use <datalist> with any of the input types men-
tioned previously: for example, url , email , etc. It's possible also
to dynamically repopulate the options as the user types, replicat-
ing the Google Suggest functionality. See
articles/view/an-html5-style-google-suggest/ for more details.
Search WWH ::

Custom Search