HTML Input Types
The HTML input type is used to control the web-based forms to accept data from the user.
Users can enter data using forms and these input types elements in HTML help to send data
to the server and makes it easier for the browser to understand that the data is valid or not.
Users can enter data using forms and these input types elements in HTML help to send data
to the server and makes it easier for the browser to understand that the data is valid or not.
There are so many input types in HTML like HTML input email, date, button, etc.. let’s see the
most common HTML input type attributes.
most common HTML input type attributes.
Common HTML form input types
- Text Field: It is used for one-line text input fields.
- Password: It is used for one-line Password input fields.
- Submit: Specifies a submit button to submit the form to the server.
- Reset: Reset all values in the form.
- Radio: Allows select one option.
- Checkbox: Allow selecting multiple options form.
- Button: A clickable button to perform Task.
- File: Defines to select the file from device storage.
- Image: Defines a graphical submit button. (form html upload file)
Form Input Restrictions
- Disabled: disabled the input field.
- Max: maximum value for an input field.
- Maxlength: maximum number of characters for an input field.
- Min: minimum value for an input field.
- Pattern: the regular expression to check the input value against.
- Readonly: specifies that an input field is read-only that cannot be changed.
- Size: defines the width (in characters) of an input field.
- Value: specifies the default value for an input field.
HTML5 Input Types
HTML5 introduced 13 new input types attributes. Here is the list of all attributes.
HTML Input type email
HTML Input type email
Syntax: <input type=”email”>
HTML Number Fields
HTML Number Fields
The HTML input type Number is used to create input fields to enter numbers only. If you try
to enter an alphabet or symbols then it will show errors.
to enter an alphabet or symbols then it will show errors.
Syntax: <input type=”number”>
HTML Search Fields
HTML Search Fields
Syntax: <input type=”search”>
HTML URL Fields
HTML URL Fields
Syntax: <input type=url>
HTML Telephone Number Fields
HTML Telephone Number Fields
Syntax: <input type="tel">
HTML Range Fields
HTML Range Fields
The HTML input type Range is used to create a slider to select a value within a range of two
values.
values.
Syntax: <input type=type=”range” min=”0” max=”10”>
HTML Date Fields
HTML Date Fields
Syntax: <input type=”date”>
HTML Month Fields
HTML Month Fields
Syntax: <input type=”month”>
HTML Week Fields
HTML Week Fields
Syntax: <input type=”week”>
HTML Time Fields
HTML Time Fields
Syntax: <input type=”time”>
HTML Datetime-local Fields
HTML Datetime-local Fields
Syntax: <input type=”datetime-local”>
HTML Color Fields
HTML Color Fields
Syntax: <input type=”color”>