New form elements introduced in html5
HTML5 introduces several new form elements that provide more functionality and flexibility for creating forms. Here are some of the new form elements introduced in HTML5:
- Email:
<input type="email">
- This input type is used to create a field for entering an email address. - URL:
<input type="url">
- This input type is used to create a field for entering a URL. - Telephone:
<input type="tel">
- This input type is used to create a field for entering a telephone number. - Search:
<input type="search">
- This input type is used to create a field for entering a search query. - Color:
<input type="color">
- This input type is used to create a field for selecting a color. - Date:
<input type="date">
- This input type is used to create a field for entering a date. - Time:
<input type="time">
- This input type is used to create a field for entering a time. - DateTime:
<input type="datetime">
- This input type is used to create a field for entering a date and time. - DateTimeLocal:
<input type="datetime-local">
- This input type is used to create a field for entering a date and time with a specific time zone. - Month:
<input type="month">
- This input type is used to create a field for entering a month and year. - Week:
<input type="week">
- This input type is used to create a field for entering a week and year. - Number:
<input type="number">
- This input type is used to create a field for entering a number with a specific range and step value. - Range:
<input type="range">
- This input type is used to create a field for entering a value within a specific range. - Checkbox:
<input type="checkbox">
- This input type is used to create a checkbox that can be checked or unchecked. - Radio:
<input type="radio">
- This input type is used to create a radio button that can be selected or deselected. - File:
<input type="file">
- This input type is used to create a field for uploading a file. - Hidden:
<input type="hidden">
- This input type is used to create a hidden field that is not visible to the user.
These new form elements provide more functionality and flexibility for creating forms, and can be used to improve the user experience and reduce the need for custom JavaScript code.