Web4College

HTML input type

<input> element defines an input field in a form. type attribute defines the type of data that the input field is to contain.

There are many values of type attribute. type attribute values play an important role in making the form.

Attribute values include text, number, password, email, tel, radio, checkbox etc.

type attribute values will be described one by one.

type=text

text value indicates that the data in the input field is plain text.

Example
Try it
Candidate's name: <input type="text" name="name">
Father's name: <input type="text" name="fname">

type=tel

tel value represents that the input field consists of telephone numbers.

Example
Try it
Tel: <input type="tel" name="number">

type=email

It indicates that the input field will contain email type data.

Example
Try it
Email: <input type="email" name="email">

type=password

password value represents that the data of input field consists of password.

Example
Try it
Password: <input type="password" name="password">

type=radio

radio keyword represents that it is a radio button.

Example
Try it
<input type="radio" name="session">Morning

type=checkbox

checkbox represents the checkbox buttons.

Example
Try it
Which subject is liked most?
<input type="checkbox" name="subject">Physics

type=color

It represents the RGB color.

Example
Try it
You can choose any color?
Color:<input type="color" name="color">

type=date

date value indicates that input field contains date (that consists of year, month, day) without data zone.

Example
Try it
The date will be displayed in month,date and year.
Date:<input type="date" name="date">

type=time

time value defines the time (hours, minutes, seconds) without time zone.

Example
Try it
you will see the hours and minutes.
Time:<input type="time" name="time">

type=search

search value represents a field where search queries are made.

Example
Try it
Google: <input type="search" name="q">

type=url

URL value indicates the absolute URL in an input field.

Example
Try it
Enter URL:<input type="url" name="URL">

type=number

It describes that the data consists of numerical value.

Example
Try it
Enter Value:<input type="number" name="temperature">

type=range

It indicates the range of numerical value. The min and max attributes can be used to specify the minimum and maximum values.

Example
Try it
Range:<input type="range" name="range" >

type=file

file value defines that the data consists of files to upload. These files may be images, media, HTML or CSS etc.

Example
Try it
Upload File:<input type="file" name="uploaded-file" >

type=submit

It represents a button that submits the data of the form to a specific address.

Example
Try it
<input type="submit" name="login">

All the above example use the send button to submit the data.

type=reset

It resets the data that is already present in the input controls.

Example
Try it
<input type="reset" name="reset">