What is the HTML <input> type attribute?

Overview

In HTML, the <type> attribute specifies which <input> element we have to display. The default value is “text”.

Syntax


<input type="value">

Parameters

date: It defines the date control.

time: It defines the entering time of control.

url: It defines the field for typing the url.

week: It defines the week and the year control.

search: It defines the text field for entering a search field.

submit: It defines a submit button.

tel: It defines a field for entering a telephone number.

text: It is the default value that defines the single line text field.

range: It defines the range control.

reset: It defines a reset button.

radio: It defines a radio button.

password: It defines a password field.

file: It defines a “Browse” button and a file-select field.

image: It defines the image as a submit button.

month: It defines the month and the year control.

hidden: It defines a hidden input field.

button: It defines a clickable button.

checkbox: It defines a checkbox.

color: It defines the color picker.

datetime-local: It defines the date and time control.

email: It defines the field for the email address.

number: It defines the field for entering a number.

Code example

The basic HTML code to demonstrate the use of the <input> type: button attribute is shown here:

  • HTML

In this example, we have made a form with the input type button. We can also select the attributes according to our own choice.

Free Resources