Java Reference
In-Depth Information
One thing you've done throughout this chapter is respond to various form controls' change , click ,
focus , blur , and keypress events (among others). All of these events can be used in conjunction
with one another so that you can respond to any user input, but that requires a lot of extra code.
A better solution would be to use the input event introduced in HTML5. This new event fires when
the value of an element changes. That means you can listen for the input event on a <form/> object
and process its data as any field is updated.
The target of the input event is the element that changed. You use the input event later in this chapter.
new input types
HTML5 introduces a slew of new types for <input/> elements, and the following table lists them,
their descriptions, and a description of their output (the control's value if known). In all cases, the
value is a string object.
tYpe
desCription
Value
A control for specifying a color. The value is
the color in hexadecimal format.
A hexadecimal value of the number
( #ff00ff ).
color
Used for entering the date (year, month, and
day).
The date in yyyy‐mm‐dd format
( 2014‐07‐14 ).
date
Allows for entering the date and time based
on UTC.
Not yet supported.
datetime
A field for editing an e‐mail address. The value
is automatically validated.
The text input into the field (even if
invalid e‐mail).
email
A control for entering month and year; no time
zone.
The date in yyyy‐mm format
( 2014‐07 ).
month
Creates a control for numeric input, but does
not prohibit alpha‐character input.
The numeric data input into the field,
or an empty string if not a number.
number
Creates a native slider for imprecise numeric
input.
The value of the slider.
range
A single‐line text entry control.
The text input into the field. Line
breaks are removed.
search
Creates a control for telephone entry.
The text input into the field. Line
breaks are removed.
tel
Allows time input with no time zone.
The time in 24‐hour format (15:37 for
03:37PM).
time
A control for editing absolute URLs.
The text input into the field.
Line breaks and leading/trailing
whitespace are removed.
url
 
Search WWH ::




Custom Search