Exploring Different Input Types in HTML
Swipe to show menu
HTML provides many <input> types that let you collect different kinds of user data. Below is an overview of the most common ones.
Email and Password
type="email": accepts email addresses and does basic browser validation;type="password": hides the typed characters for security and can useminlengthandmaxlength.
index.html
Number
type="number": accepts numeric values. Use min, max, and step to control the allowed range.
index.html
Telephone
type="tel": for phone numbers. No built-in validation. Developers validate it manually.
index.html
Checkbox
type="checkbox": allows selecting multiple options. Use checked to preselect.
index.html
Radio
type="radio": selects one option from a group. All radios must share the same name.
index.html
Range Slider
type="range": a slider control for selecting a number within a range. JavaScript logic is skipped in this course.
index.html
index.js
JavaScript logic is skipped in this course.
Date and Time
type="date": calendar selector;type="time": time picker;type="datetime-local": combines time and date inputs.
index.html
For consistent styling, developers often use ready-made UI libraries instead of the default browser pickers.
You may have noticed that when you try to fill out certain fields, the browser can already suggest some auto-fill options. The browser remembers the values you've entered in fields and then suggests them to you for auto-completion.
Thanks for your feedback!
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat