HTML5 and CSS3, Second Edition

(singke) #1
Range (slider) [<inputtype="range">]
Displays a slider control. [C5, S4, F23, IE10, O10.1]

Number [<inputtype="number">]
Displays a form field for numbers, often as a spinbox. [C5, S5, O10.1,
iOS5, A3]

Color [<inputtype="color">]
Displays a field for specifying colors. [C5, O11]

Date fields [<inputtype="date">]
Displays a form field for dates. Supports date, month, or week. [C5, S5, O10.1]

Dates with times [<inputtype="datetime">]
Displays a form field for dates with times. Supports datetime, datetime-local,
or time. [S5, O10.1]

Search field [<inputtype="search">]
Displays a form field for search keywords. [C5, S4, O10.1, iOS]

A1.4 Form-Field Attributes


Autofocus support [<inputtype="text"autofocus>]
Support for placing the focus on a specific form element. [C5, S4]

Referenced in Tip 6, Jumping to the First Field with Autofocus, on page 49


Placeholder support [<inputtype="email"placeholder="[email protected]">]
Support for displaying placeholder text inside of a form field. [C5, F4, S4]

Referenced in Tip 7, Providing Hints with Placeholder Text, on page 50


Required fields [<inputtype="email"required>]
Prevent submission of pages unless the fields are filled in. [C23, F16, IE10,
O12]

Referenced in Tip 8, Validating User Input without JavaScript, on page 54


Validation via regex [<inputpattern="/^(\s*|\d+)$/">]
Prevents submission of pages unless the field’s content matches the pat-
tern. [C23, F16, IE10, O12]

Referenced in Tip 8, Validating User Input without JavaScript, on page 54


A1.5 Accessibility


The role attribute [<div role="document">]
Identifies responsibility of an element to screen readers. [C3, F3.6, S4,
IE8, O9.6]

report erratum • discuss

Form-Field Attributes • 255


Download from Wow! eBook <www.wowebook.com>

Free download pdf