HTML5 form elements
New HTML5 Form Elements
HTML5 includes the following new form elements:
- <datalist>
- <keygen>
- <output>
Note:Not all browsers support the HTML5 new form elements, but you can still use them, even if the form attributes are not supported, they will still be displayed as regular form elements.
HTML5 <datalist> Element
The <datalist> element defines a list of options for an input element.
The <datalist> element specifies the form or input element that should have auto-complete functionality. When the user starts typing in an auto-complete element, the browser should display the filled options in that element:
Use the list attribute of the <input> element to bind it with the <datalist> element.
instance
Use the <datalist> element to define the predefined values of the <input> element:
Try it out »
HTML5 <keygen> Element
The <keygen> element provides a reliable method for users to authenticate.
The <keygen> tag defines a field for a key pair generator in a form.
When the form is submitted, two keys are generated: a private key and a public key.
The private key is stored on the client, while the public key is sent to the server. The public key can be used to verify the client certificate (client certificate) later.
This element is deprecated and is no longer recommended for use. Alternatives include:
Using the Web Cryptography API to generate keys in JavaScript
Using specialized encryption libraries
instance
A form with a <keygen> field:
Try it out »
HTML5 <output> Element
The <output> element is used for different types of output, such as calculations or script output:
instance
Display the result of the calculation in the <output> element:
Try it out »
New HTML5 Form Elements
| tag | description |
|---|---|
| <datalist> | The <input> tag defines an option list. Use this element in conjunction with the input element to define possible values for the input. |
| <keygen> | The <keygen> tag defines a field for a key pair generator in a form. |
| <output> | The <output> tag defines different types of output, such as script output. |