<input> Tag Attributes

Attributes of the <input> tag
global attributes In addition to the personal attributes of the <input> tag below, any of the common HTML attributes can also be coded.
accept
alt
autocomplete
autofocus="autofocus" Sets the value of the <input autofocus> boolean attribute to true. Omitting it sets to false.
checked="checked" Sets the value of the <input checked> boolean attribute to true. Omitting it sets to false.
disabled="disabled" Sets the value of the <input disabled> boolean attribute to true. Omitting it sets to false.
form
formaction

a URI reference (or IRI reference depending on the encoding) for the destination that is to process the submitted data

Use percent escape codes as explained in the URL Encoding Tutorial for any special characters in the URI reference.

If the value of the formaction attribute resolves to an HTTP URI, it may contain any of the following components:

  1. protocol scheme, typically http: or else https:
  2. username, followed by an "@"
  3. host name or IP address
  4. port number, which defaults to 80 for the http scheme and 443 for the https scheme
  5. absolute or relative path
  6. search query, indicated by "?"
  7. fragment identifier, indicated by "#" if the response from the form submission has placemarks

If the protocol scheme, username, host name/IP address and port number are omitted the default is the current host - the same server as the base of the current document. If the path starts with a slash /..., it is an absolute path from the document root directory (AKA "web root") on the server. A relative path will be resolved relative to the base of the current document. A URI with a "#" but no fragment identifier points to the top of the response document.

formenctype="application/x-www-form-urlencoded"
formenctype="multipart/form-data"
formenctype="text/plain"
formmethod="GET"
formmethod="POST"
formmethod="PUT"
formmethod="DELETE"
formnovalidate
formtarget
height
list An <input> tag with a list attribute that references the id attribute of a <datalist> tag is used for creating an HTML combo box.
max
maxlength
min
multiple="multiple" Sets the value of the <input multiple> boolean attribute to true. Omitting it sets to false.
name The name that will be sent with a GET or POST request, which allows the server to access the value of the input field. For a group of radio buttons, all input elements in the same radio button group should have the same value for their name attribute. For other <input type>s, the value of the name attribute should be unique.
pattern
placeholder
readonly="readonly" Sets the value of the <input readonly> boolean attribute to true. Omitting it sets to false.
required="required" Sets the value of the <input required> boolean attribute to true. Omitting it sets to false.
size
src

a URI reference that resolves to the URL of a two-dimensional image resource

Use percent escape codes as explained in the URL-encoding tutorial for any special characters in the URI reference.

If the value of the src attribute resolves to an HTTP URL, it may contain any of the following components:

  1. protocol scheme, typically http: or else https:
  2. username, followed by an "@"
  3. host name or IP address
  4. port number, which defaults to 80 for the http scheme and 443 for the https scheme
  5. absolute or relative path
  6. search query, indicated by "?"

If the protocol scheme, username, host name/IP address and port number are omitted the default is the current host - the same server as the base of the current document. If the path starts with a slash /..., it is an absolute path from the document root directory (AKA "web root") on the server. A relative path will be resolved relative to the base of the current document.

step
type="button"
type="checkbox"
type="color"
type="date"
type="datetime"
type="datetime-local"
type="email"
type="file"
type="hidden"
type="image"
type="month"
type="number"
type="password"
type="radio"
type="range"
type="reset"
type="search"
type="submit"
type="tel"
type="text"
type="time"
type="url"
type="week"

The type attribute is an enumerated attribute.

type attribute values
button
indicates that a button should be displayed
checkbox
indicates that a two-state check box should be displayed
color
indicates that the input field should allow the user to enter or choose a color, possibly using a color picker
date
indicates that the input field should allow the user to enter or choose a month, day and year, possibly using a date picker
datetime
indicates that the input field should allow the user to enter or choose a month, day, year and time, possibly using a date picker
datetime-local
indicates that the input field should allow the user to enter or choose a month, day, year, time and time zone, possibly using a date picker
email
indicates that the value entered in the input field should be validated as an e-mail address
file
indicates that the input field should allow the user to enter or choose a file name, possibly using a "Browse" button that pops up a "File Open" dialog
hidden
indicates that the input field should not be displayed, but its value is to be transmitted along with other input data when the form is submitted
image
indicates that an image button should be displayed
month
indicates that the input field should allow the user to enter or choose a month and year, possibly using a date picker
number
indicates that the input field should allow the user to enter or choose a number, possibly using a spinner or slider control; if the min attribute and step attribute are both integers, then the value should be restricted to an integer value
password
indicates that the value entered into the input field should be masked to protect it from being seen by others
radio
indicates that a radio button should be displayed; if more than one radio button in the form has the same value for the name attribute, only one button with the same name can be selected at any one time
range
indicates that the input field should allow the user to enter or choose a value within a specific range, possibly using a spinner or slider control
For a good example of <input type="range">, see the HTML Color Picker.
reset
indicates that a reset button should be displayed, which resets the input fields in the form to their default values
indicates that a search field should be displayed
submit
indicates that a submit button should be displayed, which typically submits the form
tel
indicates that the value entered in the input field should be validated as a telephone number
text
used for a free-form text input field, without any validation
time
indicates that the input field should allow the user to enter or choose a time, possibly using a spinner control
url
indicates that the value entered in the input field should be validated as a URL
week
indicates that the input field should allow the user to enter or choose a year and week, possibly using a date picker
value
width