HTML <input> type Attribute

❮ HTML <input> tag

Example

<form action="action.php">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname">

  <label for="lname">Last name:</label>
  <input type="text" id="lname" name="lname">
  
  <input type="submit" value="Submit">
</form>

Meaning

The type of input is set by the type attribute and can be a variety of different types


Standard Syntax

HTML: <input type="value">

XHTML: <input type="value" />



Browser Support




Status







Attribute Values

Value Description Basic Examples
button The defines a clickable button
checkbox Check box allowing single values to be selected/deselected.
color Provide controls for specifying a color; opening a color picker when active in supporting browsers.
date Provide controls for entering a date (year, month, and day, with no time).
datetime-local Provides controls for entering a date and time, with no time zone.
email Provides field for entering an email address.
file provides control to the user for select a file.
hidden Provides control that is not displayed but whose value is submitted to the server.
image Provides graphical submit button.
month Provides control for entering a month and year, with no time zone.
number Provides control for entering a number.
password A single-line text field whose value is obscured.
radio A radio button, allowing a single value to be selected out of multiple choices with the same name value.
range Provides control for entering a number whose exact value is not important.
reset A button that resets the contents of the form to default values. Not recommended.
search Provides a single-line text field for entering search strings.
submit Provides button that submits the form.
tel Provides control for entering a telephone number.
text The default value. provides single-line text field.
time Provides control for entering a time value with no time zone.
url Provides field for entering a URL.
week Peovides control for entering a date consisting of a week-year number and a week number with no time zone
❮ HTML <input> tag