List of Input Elements in HTML
One of the main component of the web is Forms. It would be very hard to collect data without them. And to make a good form we must know the Basic Input Type in HTML.
In this article, we will talk about Input Types in HTML. HTML Forms are used to collect data from a user who visits your website with the help of Input tags. These Input tags improve the user experience and make the forms more interactive.
Commonly Used Input Types:
- Button: Button is generally a push button, which is pushed to activate.
- checkbox: The checkbox must be ticked to activate it.
- color: Interface used to choose the color of our choice.
- date: Interface used to choose a date.
- Email: Interface used to accept e-mail addresses.
- File: Interface used to upload files.
- Image: Interface used to input an image.
- Month: Interface used to input years and months. The format is “YYYY-MM”.
- Number: Interface let the user enter a number.
- Password: Interface defines a password field (characters are masked for security).
- Radio: Collection of radio buttons inputting a set of options).
- Range: Slide control interface with Default range is 0 to 100.
- Reset: Interface used to resets the form to the default values.
- Search: Interface for entering a search string.
- Submit: Interface for submitting all form values to a form-handler.
- Text: Interface to input single-line text field.
The “type” attribute of the input element can be of various types as described above.
For example, if we want to make an input type button then We will write,
Attributes used in Code:
The placeholder attribute specifies a short hint that describes the expected value of an input field (e.g. a sample value or a short description of the expected format).
Let’s see some examples to know how these input types work.