Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Exploring Different Input Types in HTML | HTML Forms and User Input
Ultimate HTML

bookExploring Different Input Types in HTML

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 use minlength and maxlength.
index.html

index.html

copy

Number

type="number": accepts numeric values. Use min, max, and step to control the allowed range.

index.html

index.html

copy

Telephone

type="tel": for phone numbers. No built-in validation. Developers validate it manually.

index.html

index.html

copy

Checkbox

type="checkbox": allows selecting multiple options. Use checked to preselect.

index.html

index.html

copy

Radio

type="radio": selects one option from a group. All radios must share the same name.

index.html

index.html

copy

Range Slider

type="range": a slider control for selecting a number within a range. JavaScript logic is skipped in this course.

index.html

index.html

index.js

index.js

copy
Note
Note

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

index.html

copy
Note
Note

For consistent styling, developers often use ready-made UI libraries instead of the default browser pickers.

Note
Study More

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.

question mark

What is the main difference between the type="email" and type="password" input fields?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 5. ChapterΒ 5

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

bookExploring 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 use minlength and maxlength.
index.html

index.html

copy

Number

type="number": accepts numeric values. Use min, max, and step to control the allowed range.

index.html

index.html

copy

Telephone

type="tel": for phone numbers. No built-in validation. Developers validate it manually.

index.html

index.html

copy

Checkbox

type="checkbox": allows selecting multiple options. Use checked to preselect.

index.html

index.html

copy

Radio

type="radio": selects one option from a group. All radios must share the same name.

index.html

index.html

copy

Range Slider

type="range": a slider control for selecting a number within a range. JavaScript logic is skipped in this course.

index.html

index.html

index.js

index.js

copy
Note
Note

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

index.html

copy
Note
Note

For consistent styling, developers often use ready-made UI libraries instead of the default browser pickers.

Note
Study More

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.

question mark

What is the main difference between the type="email" and type="password" input fields?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 5. ChapterΒ 5
some-alt