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 )
and Opera.
FIguRE 3.9 <input
type=color> on the
BlackBerry.
Don't forget the name attribute!
Just because new client-side validation is built into browsers, don't forget to give your input fields (and
groups of radio buttons) unique values for the name attribute, because that's how you access these values
on the server that the form submits to. Older versions of Opera require this before the new HTML5 valida-
tion is performed, as that's what the spec said at the time.
As older versions of IE can get the id and name tangled up when you do getElementByID , we recom-
mend using the same unique value for the id and name of each field, thereby making your form more
accessible, too:
<label for=f-email>Email address</label>
<input id=f-email name=f-email type=email>
New attributes
As well as new input types, the <input> element has several
new attributes to specify behaviour and constraints: autocom-
plete , min , max , multiple , pattern , and step . There's also a new
attribute, list , that hooks up with a new element to allow a new
data input method.
The list attribute and <datalist>
The combination of an <input> with a list attribute and a
<datalist> is a combo box—a combination of a drop-down list
and a single-line textbox, that allows users to enter their own
text if they don't want to choose one of the predefined options.
 
 
Search WWH ::




Custom Search