HTML5 Form Elements
HTML5 New Form Elements
HTML5 has the following new form elements:
**Note:** Not all browsers support the new HTML5 form elements, but you can use them; even if a browser does not support the form attributes, they can still be displayed as regular form elements.
HTML5
Use The list attribute of the element is associated with the
Example
The element uses
<
input
list
=
"
browsers
"
<
datalist
id
=
"
browsers
"
<
option
value
=
"Internet Explorer
"
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari" datalist>Try it »
HTML5 Element
When the form is submitted, two keys are generated, one private and one public.
The private key is stored on the client, and the public key is sent to the server. The public key can later be used to verify the user's client certificate.
This element has been deprecated and is no longer recommended; alternatives include:
-
Generate keys in JavaScript using the Web Cryptography API
-
Use a dedicated cryptography library
Example
A form with a keygen field:
<form action="demo_keygen.asp" method="get">Username:
<input type="text" name="usr_name">Encryption:
<
keygen
name
=
"
security
"
<
input
type
=
"
submit
"
formTry it »
HTML5
Example
Displaying the result of a calculation in the
<form oninput="x.value=parseInt(a.value)+parseInt(b.value)" 0>
<input type="range" id="a" value="50">100 +
<
input
type
=
"
number
"
id
=
"
b
"
value
=
"
50
"
=
<
output
name
=
"
x
"
for
=
"a b
"
output
form
Try it »