--- title: slug: Web/HTML/Element/Input translation_of: Web/HTML/Element/input ---
The HTML <input>
element is used to create interactive controls for web-based forms in order to accept data from the user. The semantics of an <input>
varies considerably depending on the value of its type
attribute.
hidden
value, labellable element, palpable content.This element includes the global attributes.
button
: A push button with no default behavior.checkbox
: A check box. You must use the value attribute to define the value submitted by this item. Use the checked attribute to indicate whether this item is selected. You can also use the indeterminate attribute to indicate that the checkbox is in an indeterminate state (on most platforms, this draws a horizontal line across the checkbox).color
: {{HTMLVersionInline("5")}} A control for specifying a color. A color picker's UI has no required features other than accepting simple colors as text (more info).date
: {{HTMLVersionInline("5")}} A control for entering a date (year, month, and day, with no time).datetime
: {{HTMLVersionInline("5")}} A control for entering a date and time (hour, minute, second, and fraction of a second) based on UTC time zone.datetime-local
: {{HTMLVersionInline("5")}} A control for entering a date and time, with no time zone.email
: {{HTMLVersionInline("5")}} A field for editing an e-mail address. The input value is validated to contain either the empty string or a single valid e-mail address before submitting. The {{cssxref(":valid")}} and {{cssxref(":invalid")}} CSS pseudo-classes are applied as appropriate.file
: A control that lets the user select a file. Use the accept attribute to define the types of files that the control can select.hidden
: A control that is not displayed, but whose value is submitted to the server.image
: A graphical submit button. You must use the src attribute to define the source of the image and the alt attribute to define alternative text. You can use the height and width attributes to define the size of the image in pixels.month
: {{HTMLVersionInline("5")}} A control for entering a month and year, with no time zone.number
: {{HTMLVersionInline("5")}} A control for entering a floating point number.password
: A single-line text field whose value is obscured. Use the maxlength attribute to specify the maximum length of the value that can be entered.radio
: A radio button. You must use the value attribute to define the value submitted by this item. Use the checked attribute to indicate whether this item is selected by default. Radio buttons that have the same value for the name attribute are in the same "radio button group"; only one radio button in a group can be selected at one time.range
: {{HTMLVersionInline("5")}} A control for entering a number whose exact value is not important. This type control uses the following default values if the corresponding attributes are not specified:
min
: 0max
: 100value
: min
+ (max
-min
)/2, or min
if max
is less than min
step
: 1reset
: A button that resets the contents of the form to default values.search
: {{HTMLVersionInline("5")}} A single-line text field for entering search strings; line-breaks are automatically removed from the input value.submit
: A button that submits the form.tel
: {{HTMLVersionInline("5")}} A control for entering a telephone number; line-breaks are automatically removed from the input value, but no other syntax is enforced. You can use attributes such as pattern and maxlength to restrict values entered in the control. The {{cssxref(":valid")}} and {{cssxref(":invalid")}} CSS pseudo-classes are applied as appropriate.text
: A single-line text field; line-breaks are automatically removed from the input value.time
: {{HTMLVersionInline("5")}} A control for entering a time value with no time zone.url
: {{HTMLVersionInline("5")}} A field for editing a URL. The input value is validated to contain either the empty string or a valid absolute URL before submitting. Line-breaks and leading or trailing whitespace are automatically removed from the input value. You can use attributes such as pattern and maxlength to restrict values entered in the control. The {{cssxref(":valid")}} and {{cssxref(":invalid")}} CSS pseudo-classes are applied as appropriate.week
: {{HTMLVersionInline("5")}} A control for entering a date consisting of a week-year number and a week number with no time zone.file
, this attribute indicates the types of files that the server accepts; otherwise it is ignored. The value must be a comma-separated list of unique content type specifiers:
audio/*
representing sound files {{HTMLVersionInline("5")}}video/*
representing video files {{HTMLVersionInline("5")}}image/*
representing image files {{HTMLVersionInline("5")}}go
, done
, next
, search
, and send
; these automatically get mapped to the appropriate string (and are case-insensitive).none
: Completely disables automatic capitalizationsentences
: Automatically capitalize the first letter of sentences.words
: Automatically capitalize the first letter of words.characters
: Automatically capitalize all characters.on
: {{deprecated_inline()}} Deprecated since iOS 5.off
: {{deprecated_inline()}} Deprecated since iOS 5.hidden, password,
checkbox
, radio
, file
, or a button type (button
, submit
, reset
, image
). Possible values are:
off
: The user must explicitly enter a value into this field for every use, or the document provides its own auto-completion method; the browser does not automatically complete the entry.on
: The browser can automatically complete the value based on values that the user has entered during previous uses.If the autocomplete attribute is not specified on an input element, then the browser uses the autocomplete attribute value of the <input>
element's form owner. The form owner is either the form
element that this <input>
element is a descendant of or the form element whose id is specified by the form attribute of the input element. For more information, see the {{htmlattrxref("autocomplete", "form")}} attribute in {{HTMLElement("form")}}.
The autocomplete attribute also controls whether Firefox will, unlike other browsers, persist the dynamic disabled state and (if applicable) dynamic checkedness of an {{HTMLElement("input")}} across page loads. The persistence feature is enabled by default. Setting the value of the autocomplete attribute to off
disables this feature; this works even when the autocomplete attribute would normally not apply to the {{HTMLElement("input")}} by virtue of its type. See {{bug(654072)}}.
on
: Enable autocorrectionoff
: Disable autocorrectionhidden
(that is, you cannot automatically set focus to a hidden control).search
, previous search term values will persist in the dropdown across page load.When the value of the type attribute is radio
or checkbox
, the presence of this Boolean attribute indicates that the control is selected by default; otherwise it is ignored.
Firefox will, unlike other browsers, by default, persist the dynamic checked state of an {{HTMLElement("input")}} across page loads. Use the {{htmlattrxref("autocomplete","input")}} attribute to control this feature.
This Boolean attribute indicates that the form control is not available for interaction. In particular, the click
event will not be dispatched on disabled controls. Also, a disabled control's value isn't submitted with the form.
Firefox will, unlike other browsers, by default, persist the dynamic disabled state of an {{HTMLElement("input")}} across page loads. Use the {{htmlattrxref("autocomplete","input")}} attribute to control this feature.
<input>
element must be a descendant of a {{HTMLElement("form")}} element. This attribute enables you to place <input>
elements anywhere within a document, not just as descendants of their form elements. An input can only be associated with one form.application/x-www-form-urlencoded
: The default value if the attribute is not specified.multipart/form-data
: Use this value if you are using an {{HTMLElement("input")}} element with the {{htmlattrxref("type","input")}} attribute set to file
.text/plain
If this attribute is specified, it overrides the {{htmlattrxref("enctype","form")}} attribute of the element's form owner.
post
: The data from the form is included in the body of the form and is sent to the server.get
: The data from the form are appended to the form attribute URI, with a '?' as a separator, and the resulting URI is sent to the server. Use this method when the form has no side-effects and contains only ASCII characters.If specified, this attribute overrides the {{htmlattrxref("method","form")}} attribute of the element's form owner.
self
: Load the response into the same browsing context as the current one. This value is the default if the attribute is not specified._blank
: Load the response into a new unnamed browsing context._parent
: Load the response into the parent browsing context of the current one. If there is no parent, this option behaves the same way as _self
._top
: Load the response into the top-level browsing context (that is, the browsing context that is an ancestor of the current one, and has no parent). If there is no parent, this option behaves the same way as _self
.image
, this attribute defines the height of the image displayed for the button.search
. If the attribute is present, regardless of what its value is, the {{HTMLElement("input")}} fires search
events as the user edits the text value. The event is only fired after an implementation-defined timeout has elapsed since the most recent keystroke; new keystrokes reset the timeout. In other words, the event firing is debounced. If the attribute is absent, the search
event is only fired when the user explicitly initiates a search (e.g. by pressing the Enter key while within field).verbatim
: Alphanumeric, non-prose content such as usernames and passwords.latin
: Latin-script input in the user's preferred language with typing aids such as text prediction enabled. For human-to-computer communication such as search boxes.latin-name
: As latin, but for human names.latin-prose
: As latin, but with more aggressive typing aids. For human-to-human communication such as instant messaging for email.full-width-latin
: As latin-prose, but for the user's secondary languages.kana
: Kana or romaji input, typically hiragana input, using full-width characters, with support for converting to kanji. Intended for Japanese text input.katakana
: Katakana input, using full-width characters, with support for converting to kanji. Intended for Japanese text input.numeric
: Numeric input, including keys for the digits 0 to 9, the user's preferred thousands separator character, and the character for indicating negative numbers. Intended for numeric codes, e.g. credit card numbers. For actual numbers, prefer using <input type="number">tel
: Telephone input, including asterisk and pound key. Use <input type="tel"> if possible instead.email
: Email input. Use <input type="email"> if possible instead.url
: URL input. Use <input type="url"> if possible instead.hidden
, checkbox
, radio
, file
, or a button type.text
, email
, search
, password
, tel
, or url
, this attribute specifies the maximum number of characters (in Unicode code points) that the user can enter; for other control types, it is ignored. It can exceed the value of the size attribute. If it is not specified, the user can enter an unlimited number of characters. Specifying a negative number results in the default behavior; that is, the user can enter an unlimited number of characters. The constraint is evaluated only when the value of the attribute has been changed.text
, email
, search
, password
, tel
, or url
, this attribute specifies the minimum number of characters (in Unicode code points) that the user can enter; for other control types, it is ignored.email
or file
; otherwise it is ignored.text
, search
, tel
, url
or email
; otherwise it is ignored. The regular expression language is the same as JavaScript's. The pattern is not surrounded by forward slashes.text
, search
, tel
, url
or email
; otherwise it is ignored.
placeholder
attribute instead of a {{HTMLElement("label")}} element. Their purposes are different: the {{HTMLElement("label")}} attribute describes the role of the form element; that is, it indicates what kind of information is expected, the placeholder
attribute is a hint about the format the content should take. There are cases in which the placeholder
attribute is never displayed to the user, so the form must be understandable without it.{{HTMLVersionInline("5")}} This attribute is ignored if the value of the type attribute is hidden
, range
, color
, checkbox
, radio
, file
, or a button type.
hidden
, image
, or a button type (submit
, reset
, or button
). The {{cssxref(":optional")}} and {{cssxref(":required")}} CSS pseudo-classes will be applied to the field as appropriate.search
. It is used to control the maximum number of entries that should be displayed in the {{HTMLElement("input")}}'s native dropdown list of past search queries. Its value should be a nonnegative decimal integer.text
or password
, in which case, it is an integer number of characters. Starting in HTML5, this attribute applies only when the type attribute is set to text
, search
, tel
, url
, email
, or password
; otherwise it is ignored. In addition, the size must be greater than zero. If you don't specify a size, a default value of 20 is used.true
indicates that the element needs to have its spelling and grammar checked. The value default
indicates that the element is to act according to a default behavior, possibly based on the parent element's own spellcheck
value. The value false
indicates that the element should not be checked.image
, this attribute specifies a URI for the location of an image to display on the graphical submit button; otherwise it is ignored.any
or a positive floating point number. If this attribute is not set to any
, the control accepts only values at multiples of the step value greater than the minimum.radio
or checkbox
.image
, this attribute defines the width of the image displayed for the button.Note: Starting in {{Gecko("2.0")}}, calling the click()
method on an {{HTMLElement("input")}} element of type "file" opens the file picker and lets the user select files. See Using files from web applications for an example and more details.
You can't set the value of a file picker from a script; doing something like the following has no effect:
var e = getElementById("someFileInputElement"); e.value = "foo";
If you want Firefox to present a custom error message when a field fails to validate, you can use the x-moz-errormessage
attribute to do so:
<input type="email" x-moz-errormessage="Please specify a valid email address.">
Note, however, that this is not standard and will not have an effect on other browsers.
<!-- A basic input --> <input type="text" name="input" value="Type here">
<!-- A common form that includes input tags --> <form action="getform.php" method="get"> <label>First name: <input type="text" name="first_name" /></label><br /> <label>Last name: <input type="text" name="last_name" /></label><br /> <label>E-mail: <input type="email" name="user_email" /></label><br /> <input type="submit" value="Submit" /> </form>
You can use the {{htmlattrxref("mozactionhint", "input")}} attribute to specify the text for the label of the enter key on the virtual keyboard when your form is rendered on Firefox mobile. For example, to have a "Next" label, you can do this:
<input type="text" mozactionhint="next" name="sometext" />
The result is:
Specification | Status | Comment |
---|---|---|
{{SpecName('HTML WHATWG', 'the-input-element.html#the-input-element', '<input>')}} | {{Spec2('HTML WHATWG')}} | |
{{SpecName('HTML5 W3C', 'forms.html#the-input-element', '<input>')}} | {{Spec2('HTML5 W3C')}} | |
{{SpecName('HTML4.01', 'interact/forms.html#h-17.4', '<form>')}} | {{Spec2('HTML4.01')}} |
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} | 2 or earlier | 1.0 | 1.0 |
type | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} | 2 | 1.0 | 1.0 |
type=button | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} | 3 | 1.0 | 1.0 |
type=checkbox | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} {{CompatGeckoDesktop("1.9.2")}} for indeterminate value |
2 | 1.0 | 1.0 |
type=color | 21.0 |
{{CompatGeckoDesktop("29.0")}} (Not for Windows Touch yet) |
{{CompatNo}} | 11.01 | {{CompatNo}} |
type=date | 5.0 | {{CompatNo}} {{unimplemented_inline("825294")}} |
{{CompatNo}} | 10.62 | {{CompatVersionUnknown}} (recognized but no UI) |
type=datetime |
{{CompatNo}} |
{{CompatNo}} {{unimplemented_inline("825294")}} |
{{CompatNo}} | 10.62 | {{CompatVersionUnknown}} (recognized but no UI) |
type=datetime-local | 5.0 | {{CompatNo}} {{unimplemented_inline("825294")}} |
{{CompatNo}} | 10.62 | {{CompatVersionUnknown}} (recognized but no UI) |
type=email | 5.0 | {{CompatGeckoDesktop("2.0")}} | 10 | 10.62 | {{CompatUnknown}} |
type=file | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} | 3.02 | 1.0 | 1.0 |
type=hidden | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} | 2 | 1.0 | 1.0 |
type=image | 1.0 | Gecko 2.0 only sends x and y coordinates when clicked, not longer the name/value of the element | 2 | 1.0 | 1.0 |
type=month | 5.0 | {{CompatNo}} {{unimplemented_inline("446510")}} |
{{CompatNo}} | 10.62 | {{CompatVersionUnknown}} (recognized but no UI) |
type=number | 6.0 (Localization in Chrome 11) | {{CompatGeckoDesktop("29.0")}} | 10 (recognized but no UI) |
10.62 | {{CompatVersionUnknown}} |
type=password | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} | 2 | 1.0 | 1.0 |
type=radio | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} {{CompatGeckoDesktop("1.9.2")}} for indeterminate value |
2 | 1.0 | 1.0 |
type=range | 5.0 | {{CompatGeckoDesktop("23.0")}} | 10 | 10.62 (11.01 added support for a default value) | {{CompatVersionUnknown}} |
type=reset | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} | 2 | 1.0 | 1.0 |
type=search | 5.0 | {{CompatGeckoDesktop("2.0")}} | 10 | 11.01 | {{CompatVersionUnknown}} |
type=submit | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} | 2 | 1.0 | 1.0 |
type=tel | 5.0 | {{CompatGeckoDesktop("2.0")}} | 10 | 11.01 | {{CompatUnknown}} |
type=text | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} | 2 | 1.0 | 1.0 |
type=time | 5.0 | {{CompatNo}} {{unimplemented_inline("825294")}} |
{{CompatNo}} | 10.62 | {{CompatVersionUnknown}} (recognized but no UI) |
type=url | 5.0 | {{CompatGeckoDesktop("2.0")}} | 10 | 10.62 | {{CompatUnknown}} |
type=week | 5.0 | {{CompatNo}} {{unimplemented_inline("825294")}} |
{{CompatNo}} | 10.62 | {{CompatVersionUnknown}} (recognized but no UI) |
accept=[file extension] |
{{CompatVersionUnknown}} | {{CompatNo}} | 10 | {{CompatUnknown}} | {{CompatNo}} |
accept=[MIME type] |
8.0 | {{CompatGeckoDesktop("16.0")}} | 10 | 10 | {{CompatNo}} |
accept=audio/* | {{CompatVersionUnknown}} | {{CompatGeckoDesktop("2.0")}} Filters for the following audio file extensions: .aac, .aif, .flac, .iff, .m4a, .m4b, .mid, .midi, .mp3, .mpa, .mpc, .oga, .ogg, .ra, .ram, .snd, .wav, .wma |
10 | {{CompatNo}} | {{CompatNo}} |
accept=video/* | {{CompatVersionUnknown}} | {{CompatGeckoDesktop("2.0")}} Filters for the following video file extensions: .avi, .divx, .flv, .m4v, .mkv, .mov, .mp4, .mpeg, .mpg, .ogm, .ogv, .ogx, .rm, .rmvb, .smil, .webm, .wmv, .xvid |
10 | {{CompatNo}} | {{CompatNo}} |
accept=image/* | {{CompatVersionUnknown}} | {{CompatGeckoDesktop("2.0")}} Filters for the following image file extensions: .jpe, .jpg, .jpeg, .gif, .png, .bmp, .ico, .svg, .svgz, .tif, .tiff, .ai, .drw, .pct, .psp, .xcf, .psd, .raw |
10 | {{CompatNo}} | {{CompatNo}} |
accept=[. + ext] | {{CompatUnknown}} | {{CompatGeckoDesktop("37.0")}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
accesskey | 1.0 | {{CompatVersionUnknown}} | 6 | 1.0 | {{CompatUnknown}} |
mozactionhint | {{CompatNo}} | {{CompatGeckoDesktop("2.0")}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
autocomplete | 17.0 | {{CompatGeckoDesktop("2.0")}} | 5 | 9.6 | 5.2 |
autofocus | 5.0 | {{CompatGeckoDesktop("2.0")}} | 10 | 9.6 | 5.0 |
checked | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} | 2 | 1.0 | 1.0 |
disabled | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} | 6 | 1.0 | 1.0 |
form | 9.0 | {{CompatGeckoDesktop("2.0")}} | {{CompatUnknown}} | 10.62 | {{CompatUnknown}} |
formaction | 9.0 | {{CompatGeckoDesktop("2.0")}} | 10 | 10.62 | 5.2 |
formenctype | 9.0 | {{CompatGeckoDesktop("2.0")}} | 10 | 10.62 | {{CompatUnknown}} |
formmethod | 9.0 | {{CompatGeckoDesktop("2.0")}} | 10 | 10.62 | 5.2 |
formnovalidate | 5.0 (in 6.0 only worked with HTML5 doctype, validation support in 7.0 was disabled and re-enabled in 10.0) | {{CompatGeckoDesktop("2.0")}} | 10 | 10.62 | {{CompatUnknown}} |
formtarget | 9.0 | {{CompatGeckoDesktop("2.0")}} | 10 | 10.62 | 5.2 |
height | 1.0 | {{CompatGeckoDesktop("16.0")}} | {{CompatUnknown}} | 1.0 | {{CompatUnknown}} |
incremental | {{CompatVersionUnknown}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatVersionUnknown}} |
inputmode | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
list | 20.0 | {{CompatGeckoDesktop("2.0")}} | 10 | 9.6 | {{CompatNo}} |
max | 5.0 | {{CompatGeckoDesktop("16.0")}} | {{CompatUnknown}} | 10.62 | {{CompatUnknown}} |
maxlength | 1.0 | {{CompatGeckoDesktop("1.7")}} | 2 | 1.0 | 1.0 |
min | 5.0 | {{CompatGeckoDesktop("16.0")}} | {{CompatUnknown}} | 10.62 | {{CompatUnknown}} |
minlength | 40.0 | {{CompatUnknown}} | {{CompatUnknown}} | 27.0 | {{CompatUnknown}} |
multiple | 1.0 (supported for type=file and type=email as of 5.0) | {{CompatGeckoDesktop("1.9.2")}} for type=file {{CompatVersionUnknown}} for type=email |
10 | 1.0 (10.62 support for type=file and as of 11.01 type=email) | {{CompatUnknown}} |
name | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} | 2 | 1.0 | 1.0 |
pattern | 5.0 | {{CompatGeckoDesktop("2.0")}} | 10 | 9.6 | {{CompatNo}} |
placeholder | 10.0 | {{CompatGeckoDesktop("2.0")}} | 10 | 11.00 | 5.0 |
readonly | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} | 6 (missing for type of checkbox , radio ) |
1.0 | 1.0 |
required | 5.0 (support for select element as of 10) | {{CompatGeckoDesktop("2.0")}} | 10 | 9.6 | {{CompatNo}} |
size | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} | 2 | 1.0 | 1.0 |
spellcheck | 10.0 | {{CompatGeckoDesktop("1.9.2")}} | 10 | 11.0 | 4.0 |
src | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} | 2 | 1.0 | 1.0 |
step | 6.0 | {{CompatGeckoDesktop("16.0")}} | 10 | 10.62 | 5.0 |
tabindex | 1.0 | {{CompatGeckoDesktop("1.7 or earlier")}} | 6 (elements with tabindex > 0 are not navigated) | {{CompatVersionUnknown}} | {{CompatUnknown}} |
width | 1.0 | {{CompatGeckoDesktop("16.0")}} | {{CompatUnknown}} | 1.0 | {{CompatUnknown}} |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatGeckoMobile("2.0")}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
type | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
type=button | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
type=checkbox | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
type=color | {{CompatUnknown}} | {{CompatGeckoDesktop("27.0")}} | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatUnknown}} |
type=date | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | 10.62 | 5.0 |
type=datetime | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | 10.62 | {{CompatVersionUnknown}} |
type=datetime-local | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | 10.62 | {{CompatVersionUnknown}} |
type=email | {{CompatUnknown}} | {{CompatGeckoMobile("2.0")}} | {{CompatUnknown}} | {{CompatVersionUnknown}} | 3.1 (no validation but gives a specific keyboard) |
type=file | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatVersionUnknown}} [1] |
type=hidden | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
type=image | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
type=month | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | 10.62 | {{CompatVersionUnknown}} |
type=number | 2.3 (no validation but gives a specific keyboard) | {{CompatGeckoMobile("29.0")}} | {{CompatUnknown}} | {{CompatVersionUnknown}} | 4.0 (no validation but gives a specific keyboard) |
type=password | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
type=radio | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
type=range | {{CompatUnknown}} | {{CompatNo}} | {{CompatUnknown}} | {{CompatVersionUnknown}} | 5.0 |
type=reset | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
type=search | {{CompatUnknown}} | {{CompatGeckoMobile("2.0")}} | {{CompatUnknown}} | 10.62 | 4.0 |
type=submit | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
type=tel | 2.3 | {{CompatGeckoMobile("2.0")}} | {{CompatUnknown}} | 10.62 | 3.1 |
type=text | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
type=time | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | 10.62 | {{CompatVersionUnknown}} |
type=url | {{CompatUnknown}} | {{CompatGeckoMobile("2.0")}} | {{CompatUnknown}} | 10.62 | 3.1 (no validation but gives a specific keyboard) |
type=week | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | 10.62 | {{CompatVersionUnknown}} |
accept=[MIME type] | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
accept=audio/* | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
accept=image/* | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
accept=video/* | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
accept=[. + ext] | {{CompatUnknown}} | {{CompatGeckoMobile("37.0")}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
accesskey | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
autocomplete | {{CompatUnknown}} | {{CompatGeckoMobile("2.0")}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
autofocus | 3.2 | {{CompatGeckoMobile("2.0")}} | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatUnknown}} |
checked | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
disabled | {{CompatVersionUnknown}} | {{CompatGeckoMobile("2.0")}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
form | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
formaction | {{CompatUnknown}} | {{CompatGeckoMobile("2.0")}} | {{CompatUnknown}} | 10.62 | 5.0 |
formenctype | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
formmethod | {{CompatUnknown}} | {{CompatGeckoMobile("2.0")}} | {{CompatUnknown}} | 10.62 | 5.0 |
formnovalidate | {{CompatUnknown}} | {{CompatGeckoMobile("2.0")}} | {{CompatUnknown}} | 10.62 | {{CompatUnknown}} |
formtarget | {{CompatUnknown}} | {{CompatGeckoMobile("2.0")}} | {{CompatUnknown}} | 10.62 | 5.0 |
height | {{CompatUnknown}} | {{CompatGeckoMobile("16.0")}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
list | {{CompatNo}} | {{CompatGeckoMobile("2.0")}} | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatUnknown}} |
max | {{CompatUnknown}} | {{CompatGeckoMobile("16.0")}} (UI might remain unimplemented) | {{CompatUnknown}} | 10.62 | {{CompatUnknown}} |
maxlength | {{CompatVersionUnknown}} | {{CompatGeckoMobile("2.0")}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
min | {{CompatUnknown}} | {{CompatGeckoMobile("16.0")}} (UI might remain unimplemented) | {{CompatUnknown}} | 10.62 | {{CompatUnknown}} |
minlength | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
multiple | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatUnknown}} |
name | {{CompatVersionUnknown}} | {{CompatGeckoMobile("2.0")}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | 1.0 |
pattern | {{CompatUnknown}} | {{CompatGeckoMobile("2.0")}} | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
placeholder | 2.3 | {{CompatGeckoMobile("2.0")}} | {{CompatUnknown}} | 11.10 | 4 |
readonly | {{CompatVersionUnknown}} | {{CompatGeckoMobile("2.0")}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
required | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatUnknown}} |
size | {{CompatVersionUnknown}} | {{CompatGeckoMobile("2.0")}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
spellcheck | {{CompatUnknown}} | {{CompatGeckoMobile("2.0")}} | {{CompatUnknown}} | 11.0 | {{CompatUnknown}} |
src | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
step | {{CompatUnknown}} | {{CompatGeckoMobile("16.0")}} (UI might remain unimplemented) | {{CompatUnknown}} | 10.62 | {{CompatUnknown}} |
tabindex | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
width | {{CompatUnknown}} | {{CompatGeckoMobile("16.0")}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
[1]: File uploads were broken in Mobile Safari for iOS 8.0 and 8.0.1. The bug was fixed in iOs 8.0.2.
Safari Mobile for iOS applies a default style of {{cssxref("opacity")}}: 0.4
to disabled textual {{HTMLElement("input")}} elements. Other major browsers don't currently share this particular default style.
On Safari Mobile for iOS, setting {{cssxref("display")}}: block
on an {{HTMLElement("input")}} of type="date"
, type="time"
, type="datetime-local"
, or type="month"
causes the text within the {{HTMLElement("input")}} to become vertically misaligned. See WebKit bug #139848.
As of Chrome v39, an <input type="date">
styled with {{cssxref("display")}}: table-cell; {{cssxref("width")}}: 100%;
will have a {{cssxref("min-width")}} imposed by Chrome and it cannot become narrower than this minimum width. See Chromium bug #346051.
Firefox will, unlike other browsers, by default, persist the dynamic disabled state and (if applicable) dynamic checkedness of an {{HTMLElement("input")}} across page loads. Setting the value of the {{htmlattrxref("autocomplete","input")}} attribute to off
disables this feature; this works even when the {{htmlattrxref("autocomplete","input")}} attribute would normally not apply to the {{HTMLElement("input")}} by virtue of its {{htmlattrxref("type","input")}}. See {{bug(654072)}}.
Starting in Gecko 9.0 {{geckoRelease("9.0")}}, Firefox for Android lets users capture images using their camera and upload them, without having to leave the browser. Web developers can implement this feature by simply specifying setting the accept
attribute's value to "image/*" on their file
input, like this:
<input type="file" accept="image/*">
Firefox for Android sets a default {{ cssxref("background-image") }} gradient on all type="text"
, type="file"
, type="button"
, and type="submit"
inputs. This can be disabled using background-image: none
.
Firefox for Android also sets a default {{ cssxref("border") }} on all <input type="file">
elements.
The allowed inputs for certain <input> types depend on the locale. In some locales, 1,000.00 is a valid number, while in other locales the valid way to enter this number is 1.000,00.
Firefox uses the following heuristics to determine the locale to validate the user's input (at least for type="number"):
{{HTMLRef}}