What are the different new form element types in HTML5?
HTML5 added many new input types, which give built-in checks and better keyboards on phones.
| Type | Use |
|---|---|
email | Email address |
number | Numbers, with min and max |
tel | Phone number |
url | Website address |
date, time, month, week | Date and time pickers |
color | Colour picker |
range | Slider |
search | Search box |
It also added the <datalist> element for suggestions, the <output> element for results, and attributes like placeholder, required, pattern, autofocus and min/max.
<input list="browsers" name="browser">
<datalist id="browsers">
<option value="Chrome">
<option value="Firefox">
</datalist>
Full list in HTML Input Types.
Learn more about the similar topics:
| Tutorials |
|---|
| HTML Input Types |
| HTML Forms |
| Exercises & Assignments |
|---|
| Write an HTML program to create a registration form |
| Write an HTML program to create a contact form |
| Interview Questions & Answers |
|---|
| What are the different new form element types in HTML5? |
| What is the difference between GET and POST methods in an HTML form? |
| What is the use of the label tag in HTML? |