Loading Please Wait...

Logo Lynxsia IT Solutions

HTML Input Types

HTML Input Types

Based on the data we want to collect from users, HTML form support different types of inputs such as dates, passwords, emails, url, phone, etc.

Value For Input Types

HTML input element have the following values for type attribute:

  • <input type="button">
  • <input type="checkbox">
  • <input type="color">
  • <input type="date">
  • <input type="datetime-local">
  • <input type="email">
  • <input type="file">
  • <input type="hidden">
  • <input type="image">
  • <input type="month">
  • <input type="number">
  • <input type="password">
  • <input type="radio">
  • <input type="range">
  • <input type="reset">
  • <input type="search">
  • <input type="submit">
  • <input type="tel">
  • <input type="text"> (default)
  • <input type="time">
  • <input type="url">
  • <input type="week">
Input Type Button

It defines a clickable button

Example Code
					 
            
              <input type="button" value="Button">
            
          
Example Output
Input Type Checkbox

It defines a checkbox to let users select one or multiple option.

Example Code
					 
            
              <input type="checkbox" value="html" id="html">
              <label for="html">HTML</label><br>
              <input type="checkbox" value="html" id="html">
              <label for="css">CSS</label>
            
          
Example Output

Input Type Color

It defines a color picker to let users select colors. It's visibility and layout depends on browser supports.

Example Code
					 
            
              <input type="color">
            
          
Example Output
Input Type Date

It defines a date picker to let users select date. It's visibility and layout depends on browser supports.

Example Code
					 
            
              <input type="date">
            
          
Example Output
Input Type Datetime Local

It defines a datetime picker with no time zone to let users select date. It's visibility and layout depends on browser supports.

Example Code
					 
            
              <input type="datetime-local">
            
          
Example Output
Input Type Email

It defines an email. It is automatically validated for valid email depends on browser supports. Some mobile phone also support for email input and add ".com" or "@gmail.com" on keyboard.

Example Code
					 
            
              <input type="email">
            
          
Example Output
Input Type File

It defines a file input. Browser add a "Browse" button to select file. <form> element must include enctype="multipart/form-data" attribute when submitting files.

Example Code
					 
            
              <input type="file">
            
          
Example Output
Input Type Hidden

It defines a hidden input that is not visible to user. When there is a need to send critical data along side the form such as token, use this filed.

Example Code
					 
            
              <input type="hidden">
            
          
Example Output
Input Type Image

It defines an image as submit button

Example Code
					 
            
              <input type="image" src="logo.png" width="40" height="40">
            
          
Example Output
Input Type Month

It defines a month and year picker. It's visibility and layout depends on browser supports.

Example Code
					 
            
              <input type="month">
            
          
Example Output
Input Type Number

It defines a number input. It restrict user to enter only numbers (1, 2, 3, 1.2, etc.) characters and symbols are not allowed.

Example Code
					 
            
              <input type="number">
            
          
Example Output
Input Type Password

It defines a password input. It's data is show ad dots.

Example Code
					 
            
              <input type="password">
            
          
Example Output
Input Type Radio

It defines a radio to let users select one option from set of multiple option.

Example Code
					 
            
              <input type="radio" value="male" id="male">
              <label for="male">Male</label><br>
              <input type="radio" value="female" id="female">
              <label for="female">Female</label>
            
          
Example Output

Input Type Range

It defines a range or slider.

Example Code
					 
            
              <input type="range" min="1" max="100">
            
          
Example Output
Input Type Reset

It defines a form reset button which reset all form values to defaults.

Example Code
					 
            
              <input type="text">
              <input type="reset">
            
          
Example Output
Input Type Search

It defines a search input similar to that of text field only a cross sign - "x" is added at the end.

Example Code
					 
            
              <input type="search">
            
          
Example Output
Input Type Submit

It defines a form submit button.

Example Code
					 
            
              <input type="text">
              <input type="submit">
            
          
Example Output
Input Type Tel

It defines a telephonic input.

Example Code
					 
            
              <input type="tel">
            
          
Example Output
Input Type Text

It defines a single line text input.

Example Code
					 
            
              <input type="text">
            
          
Example Output
Input Type Time

It defines a time picker to let users select time (no time zone). It's visibility and layout depends on browser supports.

Example Code
					 
            
              <input type="time">
            
          
Example Output
Input Type URL

It defines a URL input. It is automatically validated depending on the browser supports.

Example Code
					 
            
              <input type="url">
            
          
Example Output
Input Type Week

It defines a week and year picker to let users select week and year. It's visibility and layout depends on browser supports.

Example Code
					 
            
              <input type="week">
            
          
Example Output

How you feel about this blog:

Share this blog on:

Report Us

If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com

Contact Us
Ads
Logo
Lynxsia IT Solutions

We are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..

Kotwali Road, Chhiptehri, Banda, 210001, UP, India

Copyright © 2022, Lynxsia IT Solutions, All rights reserved