mozilla

Revision 10925 of <input>

  • Revision slug: HTML/Element/Input
  • Revision title: input
  • Revision id: 10925
  • Created:
  • Creator: Crash
  • Is current revision? No
  • Comment 23 words added

Revision Content

The input (<input>) element is used to create interactive controls for web-based forms.

Usage context

Content categories Flow content; phrasing content; interactive content (if not in the hidden state); listed, labelable, submittable, resettable, form-associated element.
Permitted content None, this is a void element.
Tag omission Must have a start tag and must not have an end tag.
Normative document HTML 5, section 4.10.7; HTML 4.01, section 17.4

Attributes

Like all other HTML elements, this element supports the global attributes.

{{ htmlattrdef("type") }}
The type of control to display. The default type is text, if this attribute is not specified. Possible values are:
  • 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: A control for specifying a color. {{ HTMLVersionInline("5") }}
  • date: A control for entering a date (year, month, and day, with no time). {{ HTMLVersionInline("5") }}
  • datetime: A control for entering a date and time (hour, minute, second, and fraction of a second) based on UTC time zone. {{ HTMLVersionInline("5") }}
  • datetime-local: A control for entering a date and time, with no time zone. {{ HTMLVersionInline("5") }}
  • email: A field for editing an e-mail address. The {{ cssxref(":valid") }} and {{ cssxref(":invalid") }} CSS pseudo-classes are applied as appropriate. {{ HTMLVersionInline("5") }}
  • 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: A control for entering a month and year, with no time zone. {{ HTMLVersionInline("5") }}
  • number: A control for entering a floating point number. {{ HTMLVersionInline("5") }}
  • 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: 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: 0
    • max: 100
    • valuemin + (max-min)/2, or min if max is less than min
    • step: 1
    {{ HTMLVersionInline("5") }}
  • reset: A button that resets the contents of the form to default values.
  • search: A single-line text field for entering search strings; line-breaks are automatically removed from the input value. {{ HTMLVersionInline("5") }}
  • submit: A button that submits the form.
  • tel: 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. {{ HTMLVersionInline("5") }}
  • text: A single-line text field; line-breaks are automatically removed from the input value.
  • time: A control for entering a time value with no time zone. {{ HTMLVersionInline("5") }}
  • url: A field for editing a URL. The user may enter a blank or invalid address. Line-breaks 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. {{ HTMLVersionInline("5") }}
  • week: A control for entering a date consisting of a week-year number and a week number with no time zone. {{ HTMLVersionInline("5") }}
{{ htmlattrdef("accept") }}
If the value of the type attribute is 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:
  • A valid MIME type with no extensions
  • audio/* representing sound files {{ HTMLVersionInline("5") }}
  • video/* representing video files {{ HTMLVersionInline("5") }}
  • image/* representing image files {{ HTMLVersionInline("5") }}
{{ htmlattrdef("accesskey") }} {{ HTMLVersionInline("4") }} only, {{ obsolete_inline() }} in {{ HTMLVersionInline("5") }}
A single-character that the user can press to switch input focus to the control. This attribute is global in {{ HTMLVersionInline("5") }}.
{{ htmlattrdef("mozactionhint") }} {{ non-standard_inline() }}
Specifies an "action hint" used to determine how to label the enter key on mobile devices with virtual keyboards. Supported values are go, done, next, search, and send; these automatically get mapped to the appropriate string (and are case-insensitive).
{{ htmlattrdef("autocomplete") }} {{ HTMLVersionInline("5") }}
This attribute indicates whether the value of the control can be automatically completed by the browser. This attribute is ignored if the value of the type attribute is hidden, 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 {{ HTMLElement("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.

{{ htmlattrdef("autofocus") }} {{ HTMLVersionInline("5") }}
This Boolean attribute lets you specify that a form control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form element in a document can have the autofocus attribute, which is a Boolean. It cannot be applied if the type attribute is set to hidden (that is, you cannot automatically set focus to a hidden control).
{{ htmlattrdef("checked") }}
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.
{{ htmlattrdef("disabled") }}
This Boolean attribute indicates that the form control is not available for interaction.

This attribute is ignored if the value of the type attribute is hidden.

{{ htmlattrdef("form") }} {{ HTMLVersionInline("5") }}
The form element that the input element is associated with (its form owner). The value of the attribute must be an id of a {{ HTMLElement("form") }} element in the same document. If this attribute is not specified, this <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.
{{ htmlattrdef("formaction") }}{{ HTMLVersionInline("5") }}
The URI of a program that processes the information submitted by the input element, if it is a submit button or image. If specified, it overrides the {{ htmlattrxref("action","form") }} attribute of the element's form owner.
{{ htmlattrdef("formenctype") }}{{ HTMLVersionInline("5") }}
If the input element is a submit button or image, this attribute specifies the type of content that is used to submit the form to the server. Possible values are:
  • 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.

{{ htmlattrdef("formmethod") }}{{ HTMLVersionInline("5") }}
If the input element is a submit button or image, this attribute specifies the HTTP method that the browser uses to submit the form. Possible values are:
  • 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.

{{ htmlattrdef("formnovalidate") }}{{ HTMLVersionInline("5") }}
If the input element is a submit button or image, this Boolean attribute specifies that the form is not to be validated when it is submitted. If this attribute is specified, it overrides the {{ htmlattrxref("novalidate","form") }} attribute of the element's form owner.
{{ htmlattrdef("formtarget") }}{{ HTMLVersionInline("5") }}
If the input element is a submit button or image, this attribute is a name or keyword indicating where to display the response that is received after submitting the form. This is a name of, or keyword for, a browsing context (for example, tab, window, or inline frame). If this attribute is specified, it overrides the {{ htmlattrxref("target", "form") }} attribute of the elements's form owner. The following keywords have special meanings:
  • _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.
{{ htmlattrdef("height") }} {{ HTMLVersionInline("5") }}
 If the value of the type attribute is image, this attribute defines the height of the image displayed for the button.
{{ htmlattrdef("list") }} {{ HTMLVersionInline("5") }}
Identifies a list of pre-defined options to suggest to the user. The value must be the id of a {{ HTMLElement("datalist") }} element in the same document. The browser displays only options that are valid values for this input element. This attribute is ignored when the type attribute's value is hidden, checkbox, radio, file, or a button type.
{{ htmlattrdef("max") }} {{ HTMLVersionInline("5") }} 
The maximum (numeric or date-time) value for this item, which must not be less than its minimum (min attribute) value.
{{ htmlattrdef("maxlength") }} {{ HTMLVersionInline("5") }}
If the value of the type attribute is text, 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.
{{ htmlattrdef("min") }} {{ HTMLVersionInline("5") }} 
The minimum (numeric or date-time) value for this item, which must not be greater than its maximum (max attribute) value.
{{ htmlattrdef("multiple") }}{{ HTMLVersionInline("5") }}
This Boolean attribute indicates whether the user can enter more than one value. This attribute applies when the type attribute is set to email or file; otherwise it is ignored.
{{ htmlattrdef("name") }}
The name of the control, which is submitted with the form data.
{{ htmlattrdef("pattern") }}{{ HTMLVersionInline("5") }}
A regular expression that the control's value is checked against. The pattern must match the entire value, not just some subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is text, search, tel, url or email; otherwise it is ignored.
{{ htmlattrdef("placeholder") }} {{ HTMLVersionInline("5") }}
A hint to the user of what can be entered in the control . The placeholder text must not contain carriage returns or line-feeds. This attribute applies when the value of the type attribute is text, search, tel, url or email; otherwise it is ignored.
{{ htmlattrdef("readonly") }}
This Boolean attribute indicates that the user cannot modify the value of the control.

{{ HTMLVersionInline("5") }} This attribute is ignored if the value of the type attribute is hidden, range, color, checkbox, radio, file, or a button type.

{{ htmlattrdef("required") }} {{ HTMLVersionInline("5") }}
This attribute specifies that the user must fill in a value before submitting a form. It cannot be used when the type attribute is 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.
{{ htmlattrdef("size") }}
The initial size of the control. This value is in pixels unless the value of the type attribute is text or password, in which case, it is an integer number of characters. Starting in {{ HTMLVersionInline("5") }}, 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.
{{ htmlattrdef("src") }}
If the value of the type attribute is image, this attribute specifies a URI for the location of an image to display on the graphical submit button; otherwise it is ignored.
{{ htmlattrdef("step") }} {{ HTMLVersionInline("5") }}
Works with the min and max attributes to limit the increments at which a numeric or date-time value can be set. It can be the string 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.
{{ htmlattrdef("tabindex") }} element-specific in {{ HTMLVersionInline("4") }}, global in {{ HTMLVersionInline("5") }}
The position of the element in the tabbing navigation order for the current document.
{{ htmlattrdef("usemap") }} {{ HTMLVersionInline("4") }} only, {{ obsolete_inline() }} in {{ HTMLVersionInline("5") }}
The name of a {{ HTMLElement("map") }} element to as an image map.
{{ htmlattrdef("value") }}
The initial value of the control. This attribute is optional except when the value of the type attribute is radio or checkbox.
{{ htmlattrdef("width") }} {{ HTMLVersionInline("5") }}
 If the value of the type attribute is image, this attribute defines the width of the image displayed for the button.
{{ htmlattrdef("x-moz-errormessage") }} {{ non-standard_inline() }}
This Mozilla extension allows you to specify the error message to display when a field doesn't successfully validate.

Notes

File inputs

{{ gecko_callout_heading("2.0") }}

Starting in Gecko 2.0 {{ geckoRelease() }}, 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";

Error messages

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.

DOM interface

This element implements the HTMLInputElement interface.

Examples

A simple input box

<!-- A basic input -->
<input type="text" name="input" value="Type here">

Using mozactionhint on Firefox mobile

You can use the mozactionhint 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:

mozactionhint.png

Compatibility

{{ CompatibilityTable() }}

Feature Firefox (Gecko) Chrome Internet Explorer [1] Opera Safari
Basic support {{ CompatGeckoDesktop("1.7") }} 1.0 6 or earlier 1.0 1.0
type {{ CompatGeckoDesktop("1.7") }}   6 1.0  
type=button       1.0  

type=checkbox

{{ CompatGeckoDesktop("1.9.2") }} for indeterminate value     1.0  
type=color {{ CompatNo() }}
{{ unimplemented_inline("547004") }}
    11.01  
type=date {{ CompatNo() }}
{{ unimplemented_inline("446510") }}
    10.62  
type=datetime {{ CompatNo() }}
{{ unimplemented_inline("446510") }}
    10.62  
type=datetime-local {{ CompatNo() }}
{{ unimplemented_inline("446510") }}
    10.62  
type=email {{ CompatGeckoDesktop("2.0") }}     10.62  
type=file       1.0  
type=hidden       1.0  
type=image       1.0  
type=month {{ CompatNo() }}
{{ unimplemented_inline("446510") }}
    10.62  
type=number {{ CompatNo() }}
{{ unimplemented_inline("344616") }}
    10.62  
type=password       1.0  
type=radio {{ CompatGeckoDesktop("1.9.2") }} for indeterminate value     1.0  
type=range {{ CompatNo() }}
{{ unimplemented_inline("344618") }}
    10.62 (11.01 added support for a default value)  
type=reset       1.0  
type=search {{ CompatGeckoDesktop("2.0") }}     11.01  
type=submit       1.0  
type=tel {{ CompatGeckoDesktop("2.0") }}     11.01  
type=text {{ CompatGeckoDesktop("1.7") }}     1.0  
type=time {{ CompatNo() }}
{{ unimplemented_inline("446510") }}
    10.62  
type=url {{ CompatGeckoDesktop("2.0") }}     10.62  
type=week {{ CompatNo() }}
{{ unimplemented_inline("446510") }}
    10.62  
accept=[MIME type] {{ CompatNo() }}
{{ unimplemented_inline("565274") }}
       
accept=audio/* {{ 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
       
accept=video/* {{ 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
       
accept=image/* {{ 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
       
accesskey      6 1.0  
mozactionhint {{ CompatGeckoDesktop("2.0") }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }}
autocomplete       10.62  
autofocus       10.62  
checked      6 1.0  
disabled      6 1.0  
form       10.62  
formaction {{ CompatGeckoDesktop("2.0") }}     10.62  
formenctype {{ CompatGeckoDesktop("2.0") }}     10.62  
formmethod {{ CompatGeckoDesktop("2.0") }}     10.62  
formnovalidate {{ CompatGeckoDesktop("2.0") }}     10.62  
formtarget {{ CompatGeckoDesktop("2.0") }}     10.62  
height {{ CompatNo() }}     1.0  
list {{ CompatGeckoDesktop("2.0") }}     10.62  
max {{ CompatNo() }}
{{ unimplemented_inline(556010 }})
    10.62  
maxlength {{ CompatGeckoDesktop("1.7") }}    6 1.0  
min

{{ CompatNo() }}
{{ unimplemented_inline(556010 }})

    10.62  
multiple {{ CompatGeckoDesktop("1.9.2") }} for type=file
{{ unimplemented_inline() }} for type=email
    11.01 (support for type=file and as of 11.01 type=email)  
name {{ CompatGeckoDesktop("1.7") }}     1.0  
pattern {{ CompatGeckoDesktop("2.0") }}     10.62  
placeholder       11.01  
readonly      6 (missing for type of checkbox, radio) 1.0  
required {{ CompatGeckoDesktop("2.0") }}     10.62  
size {{ CompatGeckoDesktop("1.7") }}  

6 (missing for type of checkbox, radio, submit, reset, image, button)

1.0  
src     6 1.0  
step {{ CompatNo() }}
{{ unimplemented_inline(556009 }})
    10.62  
tabindex     6 (elements with tabindex > 0 are not navigated)

See also

  • Other form-related elements: {{ HTMLElement("form") }}, {{ HTMLElement("button") }}, {{ HTMLElement("datalist") }}, {{ HTMLElement("legend") }}, {{ HTMLElement("label") }}, {{ HTMLElement("select") }}, {{ HTMLElement("optgroup") }}, {{ HTMLElement("option") }}, {{ HTMLElement("textarea") }}, {{ HTMLElement("keygen") }}, {{ HTMLElement("fieldset") }}, {{ HTMLElement("output") }}, {{ HTMLElement("progress") }} and {{ HTMLElement("meter") }}.
  • Cross-browser HTML5 placeholder text

{{ languages( { "fr": "fr/HTML/Element/input" } ) }}

Revision Source

<p>The <em>input</em> (&lt;input&gt;) element is used to create interactive controls for web-based forms.</p>
<h2>Usage context</h2>
<table class="standard-table"> <tbody> <tr> <td>Content categories</td> <td><a href="/en/HTML/Content_categories#Flow_content" title="en/HTML/Content categories#Flow content">Flow content</a>; <a href="/en/HTML/Content_categories#Phrasing_content" title="en/HTML/Content categories#Phrasing content">phrasing content</a>; interactive content (if not in the hidden state); <a href="/en/HTML/Content_categories#form_listed" title="en/HTML/Content categories#form listed">listed</a>, <a href="/en/HTML/Content_categories#form_labelable" title="en/HTML/Content categories#form labelable">labelable</a>, <a href="/en/HTML/Content_categories#form_submittable" title="en/HTML/Content categories#form submittable">submittable</a>, <a href="/en/HTML/Content_categories#form_resettable" title="en/HTML/Content categories#form resettable">resettable</a>, <a href="/en/HTML/Content_categories#Form-associated_content" title="en/HTML/Content categories#Form-associated content">form-associated</a> element.</td> </tr> <tr> <td>Permitted content</td> <td>None, this is a void element.</td> </tr> <tr> <td>Tag omission</td> <td>Must have a start tag and must not have an end tag.</td> </tr> <tr> <td>Normative document</td> <td><a class=" external" href="http://www.w3.org/TR/html5/the-input-element.html#the-input-element" title="http://www.w3.org/TR/html5/the-input-element.html#the-input-element">HTML 5, section 4.10.7</a>; <a class=" external" href="http://www.w3.org/TR/html401/interact/forms.html#h-17.4" title="http://www.w3.org/TR/html401/interact/forms.html#h-17.4">HTML 4.01, section 17.4</a></td> </tr> </tbody>
</table>
<h2>Attributes</h2>
<p>Like all other HTML elements, this element supports the <a href="/en/HTML/Global_attributes" title="en/HTML/Global attributes">global attributes</a>.</p>
<dl> <dt>{{ htmlattrdef("type") }}</dt> <dd>The type of control to display. The default type is text, if this attribute is not specified. Possible values are: <ul> <li><code>button</code>: A push button with no default behavior.</li> <li><code>checkbox</code>: A check box. You must use the <strong>value</strong> attribute to define the value submitted by this item. Use the <strong>checked</strong> attribute to indicate whether this item is selected. You can also use the <strong>indeterminate</strong> attribute to indicate that the checkbox is in an indeterminate state (on most platforms, this draws a horizontal line across the checkbox).</li> <li><code>color</code>: A control for specifying a color. {{ HTMLVersionInline("5") }}</li> <li><code>date</code>: A control for entering a date (year, month, and day, with no time). {{ HTMLVersionInline("5") }}</li> <li><code>datetime</code>: A control for entering a date and time (hour, minute, second, and fraction of a second) based on UTC time zone. {{ HTMLVersionInline("5") }}</li> <li><code>datetime-local</code>: A control for entering a date and time, with no time zone. {{ HTMLVersionInline("5") }}</li> <li><code>email</code>: A field for editing an e-mail address. The {{ cssxref(":valid") }} and {{ cssxref(":invalid") }} CSS pseudo-classes are applied as appropriate. {{ HTMLVersionInline("5") }}</li> <li><code>file</code>: A control that lets the user select a file. Use the <strong>accept</strong> attribute to define the types of files that the control can select.</li> <li><code>hidden</code>: A control that is not displayed, but whose value is submitted to the server.</li> <li><code>image</code>: A graphical submit button. You must use the <strong>src</strong> attribute to define the source of the image and the <strong>alt</strong> attribute to define alternative text. You can use the <strong>height</strong> and <strong>width</strong> attributes to define the size of the image in pixels.</li> <li><code>month</code>: A control for entering a month and year, with no time zone. {{ HTMLVersionInline("5") }}</li> <li><code>number</code>: A control for entering a floating point number. {{ HTMLVersionInline("5") }}</li> <li><code>password</code>: A single-line text field whose value is obscured. Use the <strong>maxlength</strong> attribute to specify the maximum length of the value that can be entered.</li> <li><code>radio</code>: A radio button. You must use the <strong>value</strong> attribute to define the value submitted by this item. Use the <strong>checked</strong> attribute to indicate whether this item is selected by default. Radio buttons that have the same value for the <strong>name</strong> attribute are in the same "radio button group"; only one radio button in a group can be selected at one time.</li> <li><code>range</code>: 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: <ul> <li><code>min</code>: 0</li> <li><code>max</code>: 100</li> <li><code>value</code>: <code>min</code> + (<code>max</code>-<code>min</code>)/2, or <code>min</code> if <code>max</code> is less than <code>min</code></li> <li><code>step</code>: 1</li> </ul> {{ HTMLVersionInline("5") }}</li> <li><code>reset</code>: A button that resets the contents of the form to default values.</li> <li><code>search</code>: A single-line text field for entering search strings; line-breaks are automatically removed from the input value. {{ HTMLVersionInline("5") }}</li> <li><code>submit</code>: A button that submits the form.</li> <li><code>tel</code>: 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 <strong>pattern</strong> and <strong>maxlength</strong> to restrict values entered in the control. The {{ cssxref(":valid") }} and {{ cssxref(":invalid") }} CSS pseudo-classes are applied as appropriate. {{ HTMLVersionInline("5") }}</li> <li><code>text</code>: A single-line text field; line-breaks are automatically removed from the input value.</li> <li><code>time</code>: A control for entering a time value with no time zone. {{ HTMLVersionInline("5") }}</li> <li><code>url</code>: A field for editing a URL. The user may enter a blank or invalid address. Line-breaks are automatically removed from the input value. You can use attributes such as <strong>pattern</strong> and <strong>maxlength</strong> to restrict values entered in the control. The {{ cssxref(":valid") }} and {{ cssxref(":invalid") }} CSS pseudo-classes are applied as appropriate. {{ HTMLVersionInline("5") }}</li> <li><code>week</code>: A control for entering a date consisting of a week-year number and a week number with no time zone. {{ HTMLVersionInline("5") }}</li> </ul> </dd> <dt>{{ htmlattrdef("accept") }}</dt> <dd>If the value of the <strong>type</strong> attribute is <code>file</code>, 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: <ul> <li>A valid MIME type with no extensions</li> <li><code>audio/*</code> representing sound files {{ HTMLVersionInline("5") }}</li> <li><code>video/*</code> representing video files {{ HTMLVersionInline("5") }}</li> <li><code>image/*</code> representing image files {{ HTMLVersionInline("5") }}</li> </ul> </dd> <dt>{{ htmlattrdef("accesskey") }} {{ HTMLVersionInline("4") }} only, {{ obsolete_inline() }} in {{ HTMLVersionInline("5") }}</dt> <dd>A single-character that the user can press to switch input focus to the control. This attribute is global in {{ HTMLVersionInline("5") }}.</dd> <dt>{{ htmlattrdef("mozactionhint") }} {{ non-standard_inline() }}</dt> <dd>Specifies an "action hint" used to determine how to label the enter key on mobile devices with virtual keyboards. Supported values are <code>go</code>, <code>done</code>, <code>next</code>, <code>search</code>, and <code>send</code>; these automatically get mapped to the appropriate string (and are case-insensitive).</dd> <dt>{{ htmlattrdef("autocomplete") }} {{ HTMLVersionInline("5") }}</dt> <dd>This attribute indicates whether the value of the control can be automatically completed by the browser. This attribute is ignored if the value of the <strong>type</strong> attribute is <span style="font-family: Courier New;">hidden</span>, <span style="font-family: Courier New;">checkbox</span>, <span style="font-family: Courier New;">radio</span>, <span style="font-family: Courier New;">file</span>, or a button type (<span style="font-family: Courier New;">button</span>, <span style="font-family: Courier New;">submit</span>, <span style="font-family: Courier New;">reset</span>, <span style="font-family: Courier New;">image</span>). Possible values are: <ul> <li><span style="font-family: Courier New;">off</span>: 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.</li> <li><span style="font-family: Courier New;">on</span>: The browser can automatically complete the value based on values that the user has entered during previous uses.</li> </ul> <p>If the <strong>autocomplete</strong> attribute is not specified on an input element, then the browser uses the <strong>autocomplete</strong> attribute value of the <span style="font-family: Courier New;">&lt;input&gt;</span> element's form owner. The form owner is either the {{ HTMLElement("form") }} element that this <span style="font-family: Courier New;">&lt;input&gt;</span> element is a descendant of or the form element whose <strong>id</strong> is specified by the <strong>form</strong> attribute of the input element.</p> </dd> <dt>{{ htmlattrdef("autofocus") }} {{ HTMLVersionInline("5") }}</dt> <dd>This Boolean attribute lets you specify that a form control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form element in a document can have the <strong>autofocus</strong> attribute, which is a Boolean. It cannot be applied if the <strong>type</strong> attribute is set to <code>hidden</code> (that is, you cannot automatically set focus to a hidden control).</dd> <dt>{{ htmlattrdef("checked") }}</dt> <dd>When the value of the <strong>type</strong> attribute is <span style="font-family: Courier New;">radio</span> or <span style="font-family: Courier New;">checkbox</span>, the presence of this Boolean attribute indicates that the control is selected by default; otherwise it is ignored.</dd> <dt>{{ htmlattrdef("disabled") }}</dt> <dd>This Boolean attribute indicates that the form control is not available for interaction. <p>This attribute is ignored if the value of the <strong>type</strong> attribute is <span style="font-family: Courier New;">hidden</span>.</p> </dd> <dt>{{ htmlattrdef("form") }} {{ HTMLVersionInline("5") }}</dt> <dd>The form element that the input element is associated with (its <em>form owner</em>). The value of the attribute must be an <strong>id</strong> of a {{ HTMLElement("form") }} element in the same document. If this attribute is not specified, this <span style="font-family: Courier New;">&lt;input&gt;</span> element must be a descendant of a {{ HTMLElement("form") }} element. This attribute enables you to place <span style="font-family: Courier New;">&lt;input&gt;</span> elements anywhere within a document, not just as descendants of their form elements.</dd> <dt>{{ htmlattrdef("formaction") }}{{ HTMLVersionInline("5") }}</dt> <dd>The URI of a program that processes the information submitted by the input element, if it is a submit button or image. If specified, it overrides the {{ htmlattrxref("action","form") }} attribute of the element's form owner.</dd> <dt>{{ htmlattrdef("formenctype") }}{{ HTMLVersionInline("5") }}</dt> <dd>If the input element is a submit button or image, this attribute specifies the type of content that is used to submit the form to the server. Possible values are: <ul> <li><span style="font-family: Courier New;">application/x-www-form-urlencoded</span>: The default value if the attribute is not specified.</li> <li><span style="font-family: Courier New;">multipart/form-data</span>: Use this value if you are using an {{ HTMLElement("input") }} element with the {{ htmlattrxref("type","input") }} attribute set to <span style="font-family: Courier New;">file</span>.</li> <li><span style="font-family: Courier New;">text/plain</span></li> </ul> <p>If this attribute is specified, it overrides the {{ htmlattrxref("enctype","form") }} attribute of the element's form owner.</p> </dd> <dt>{{ htmlattrdef("formmethod") }}{{ HTMLVersionInline("5") }}</dt> <dd>If the input element is a submit button or image, this attribute specifies the HTTP method that the browser uses to submit the form. Possible values are: <ul> <li><span style="font-family: Courier New;">post</span>: The data from the form is included in the body of the form and is sent to the server.</li> <li><span style="font-family: Courier New;">get</span>: The data from the form are appended to the <strong>form</strong> 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.</li> </ul> <p>If specified, this attribute overrides the {{ htmlattrxref("method","form") }} attribute of the element's form owner.</p> </dd> <dt>{{ htmlattrdef("formnovalidate") }}{{ HTMLVersionInline("5") }}</dt> <dd>If the input element is a submit button or image, this Boolean attribute specifies that the form is not to be validated when it is submitted. If this attribute is specified, it overrides the {{ htmlattrxref("novalidate","form") }} attribute of the element's form owner.</dd> <dt>{{ htmlattrdef("formtarget") }}{{ HTMLVersionInline("5") }}</dt> <dd>If the input element is a submit button or image, this attribute is a name or keyword indicating where to display the response that is received after submitting the form. This is a name of, or keyword for, a <em>browsing context</em> (for example, tab, window, or inline frame). If this attribute is specified, it overrides the {{ htmlattrxref("target", "form") }} attribute of the elements's form owner. The following keywords have special meanings: <ul> <li>_<span style="font-family: Courier New;">self</span>: Load the response into the same browsing context as the current one. This value is the default if the attribute is not specified.</li> <li><span style="font-family: Courier New;">_blank</span>: Load the response into a new unnamed browsing context.</li> <li><span style="font-family: Courier New;">_parent</span>: Load the response into the parent browsing context of the current one. If there is no parent, this option behaves the same way as <span style="font-family: Courier New;">_self</span>.</li> <li><span style="font-family: Courier New;">_top</span>: 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 <span style="font-family: Courier New;">_self</span>.</li> </ul> </dd> <dt>{{ htmlattrdef("height") }} {{ HTMLVersionInline("5") }}</dt> <dd> If the value of the <strong>type</strong> attribute is <span style="font-family: Courier New;">image</span>, this attribute defines the height of the image displayed for the button.</dd> <dt>{{ htmlattrdef("list") }} {{ HTMLVersionInline("5") }}</dt> <dd>Identifies a list of pre-defined options to suggest to the user. The value must be the <strong>id</strong> of a {{ HTMLElement("datalist") }} element in the same document. The browser displays only options that are valid values for this input element. This attribute is ignored when the <strong>type</strong> attribute's value is <span style="font-family: Courier New;">hidden</span>, <span style="font-family: Courier New;">checkbox</span>, <span style="font-family: Courier New;">radio</span>, <span style="font-family: Courier New;">file</span>, or a button type.</dd> <dt>{{ htmlattrdef("max") }} {{ HTMLVersionInline("5") }} </dt> <dd>The maximum (numeric or date-time) value for this item, which must not be less than its minimum (<strong>min</strong> attribute) value.</dd> <dt>{{ htmlattrdef("maxlength") }} {{ HTMLVersionInline("5") }}</dt> <dd>If the value of the <strong>type</strong> attribute is <span style="font-family: Courier New;">text</span>, <span style="font-family: Courier New;">search</span>, <span style="font-family: Courier New;">password</span>, <span style="font-family: Courier New;">tel</span>, or <span style="font-family: Courier New;">url</span>,  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 <strong>size</strong> 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.</dd> <dt>{{ htmlattrdef("min") }} {{ HTMLVersionInline("5") }} </dt> <dd>The minimum (numeric or date-time) value for this item, which must not be greater than its maximum (<strong>max</strong> attribute) value.</dd> <dt>{{ htmlattrdef("multiple") }}{{ HTMLVersionInline("5") }}</dt> <dd>This Boolean attribute indicates whether the user can enter more than one value. This attribute applies when the <strong>type</strong> attribute is set to <span style="font-family: Courier New;">email</span> or <span style="font-family: Courier New;">file</span>; otherwise it is ignored.</dd> <dt>{{ htmlattrdef("name") }}</dt> <dd>The name of the control, which is submitted with the form data.</dd> <dt>{{ htmlattrdef("pattern") }}{{ HTMLVersionInline("5") }}</dt> <dd>A regular expression that the control's value is checked against. The pattern must match the entire value, not just some subset. Use the <strong>title</strong> attribute to describe the pattern to help the user. This attribute applies when the value of the <strong>type</strong> attribute is <span style="font-family: Courier New;">text</span>, <span style="font-family: Courier New;">search</span>, <span style="font-family: Courier New;">tel</span>, <span style="font-family: Courier New;">url</span> or <span style="font-family: Courier New;">email</span>; otherwise it is ignored.</dd> <dt>{{ htmlattrdef("placeholder") }} {{ HTMLVersionInline("5") }}</dt> <dd>A hint to the user of what can be entered in the control . The placeholder text must not contain carriage returns or line-feeds. This attribute applies when the value of the <strong>type</strong> attribute is <span style="font-family: Courier New;">text</span>, <span style="font-family: Courier New;">search</span>, <span style="font-family: Courier New;">tel</span>, <span style="font-family: Courier New;">url</span> or <span style="font-family: Courier New;">email</span>; otherwise it is ignored.</dd> <dt>{{ htmlattrdef("readonly") }}</dt> <dd>This Boolean attribute indicates that the user cannot modify the value of the control. <p>{{ HTMLVersionInline("5") }} This attribute is ignored if the value of the <strong>type</strong> attribute is <span style="font-family: Courier New;">hidden</span>, <span style="font-family: Courier New;">range</span>, <span style="font-family: Courier New;">color</span>, <span style="font-family: Courier New;">checkbox</span>, <span style="font-family: Courier New;">radio</span>, <span style="font-family: Courier New;">file</span>, or a button type.</p> </dd> <dt>{{ htmlattrdef("required") }} {{ HTMLVersionInline("5") }}</dt> <dd>This attribute specifies that the user must fill in a value before submitting a form. It cannot be used when the <strong>type</strong> attribute is <span style="font-family: Courier New;">hidden</span>, <span style="font-family: Courier New;">image</span>, or a button type (<span style="font-family: Courier New;">submit</span>, <span style="font-family: Courier New;">reset</span>, or <span style="font-family: Courier New;">button</span>). The {{ cssxref(":optional") }} and {{ cssxref(":required") }} CSS pseudo-classes will be applied to the field as appropriate.</dd> <dt>{{ htmlattrdef("size") }}</dt> <dd>The initial size of the control. This value is in pixels unless the value of the <strong>type</strong> attribute is <span style="font-family: Courier New;">text</span> or <span style="font-family: Courier New;">password</span>, in which case, it is an integer number of characters. Starting in {{ HTMLVersionInline("5") }}, this attribute applies only when the <strong>type</strong> attribute is set to <span style="font-family: Courier New;">text</span>, <span style="font-family: Courier New;">search</span>, <span style="font-family: Courier New;">tel</span>, <span style="font-family: Courier New;">url</span>, <span style="font-family: Courier New;">email</span>, or <span style="font-family: Courier New;">password</span>; 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.</dd> <dt>{{ htmlattrdef("src") }}</dt> <dd>If the value of the <strong>type</strong> attribute is <span style="font-family: Courier New;">image</span>, this attribute specifies a URI for the location of an image to display on the graphical submit button; otherwise it is ignored.</dd> <dt>{{ htmlattrdef("step") }} {{ HTMLVersionInline("5") }}</dt> <dd>Works with the <strong>min</strong> and <strong>max</strong> attributes to limit the increments at which a numeric or date-time value can be set. It can be the string <span style="font-family: Courier New;">any</span> or a positive floating point number. If this attribute is not set to <span style="font-family: Courier New;">any</span>, the control accepts only values at multiples of the step value greater than the minimum.</dd> <dt>{{ htmlattrdef("tabindex") }} element-specific in {{ HTMLVersionInline("4") }}, global in {{ HTMLVersionInline("5") }}</dt> <dd>The position of the element in the tabbing navigation order for the current document.</dd> <dt>{{ htmlattrdef("usemap") }} {{ HTMLVersionInline("4") }} only, {{ obsolete_inline() }} in {{ HTMLVersionInline("5") }}</dt> <dd>The name of a {{ HTMLElement("map") }} element to as an image map.</dd> <dt>{{ htmlattrdef("value") }}</dt> <dd>The initial value of the control. This attribute is optional except when the value of the <strong>type</strong> attribute is <span style="font-family: Courier New;">radio</span> or <span style="font-family: Courier New;">checkbox</span>.</dd> <dt>{{ htmlattrdef("width") }} {{ HTMLVersionInline("5") }}</dt> <dd> If the value of the <strong>type</strong> attribute is <span style="font-family: Courier New;">image</span>, this attribute defines the width of the image displayed for the button.</dd> <dt>{{ htmlattrdef("x-moz-errormessage") }} {{ non-standard_inline() }}</dt> <dd>This Mozilla extension allows you to specify the error message to display when a field doesn't successfully validate.</dd>
</dl>
<h2>Notes</h2>
<h3>File inputs</h3>
<div class="geckoVersionNote">
<p>{{ gecko_callout_heading("2.0") }}</p>
<p>Starting in Gecko 2.0 {{ geckoRelease() }}, calling the <code>click()</code> method on an {{ HTMLElement("input") }} element of type file opens the file picker and lets the user select files. See <a href="/en/Using_files_from_web_applications" title="en/Using files from web applications">Using files from web applications</a> for an example and more details.</p>
</div>
<p>You can't set the value of a file picker from a script; doing something like the following has no effect:</p>
<pre class="brush: js">var e = getElementById("someFileInputElement");
e.value = "foo";
</pre>
<h3>Error messages</h3>
<p>If you want Firefox to present a custom error message when a field fails to validate, you can use the <code>x-moz-errormessage</code> attribute to do so:</p>
<pre class="brush: html">&lt;input type="email" x-moz-errormessage="Please specify a valid email address."&gt;
</pre>
<p>Note, however, that this is not standard and will not have an effect on other browsers.</p>
<h2>DOM interface</h2>
<p>This element implements the <a href="/en/DOM/HTMLInputElement" title="en/DOM/input">HTMLInputElement</a> interface.</p>
<h2>Examples</h2>
<h3>A simple input box</h3>
<pre class="brush: html">&lt;!-- A basic input --&gt;
&lt;input type="text" name="input" value="Type here"&gt;
</pre>
<p><input name="input" type="text" value="Type here"><img align="absmiddle" alt="" class="ife_marker" id="input_ife_marker_0" src="chrome://informenter/skin/marker.png" style="border: 0pt none; width: 14px; height: 19px; cursor: pointer; display: inline;" title="Max field length is unknown"></p>
<h3>Using mozactionhint on Firefox mobile</h3>
<p>You can use the <a href="/en/HTML/Element/Input#attr-mozactionhint" title="en/HTML/Element/Input#attr-mozactionhint"><code>mozactionhint</code></a> 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:</p>
<pre>&lt;input type="text" mozactionhint="next" name="sometext" /&gt;
</pre>
<p>The result is:</p>
<p><a href="/@api/deki/files/4970/=mozactionhint.png" title="mozactionhint.png"><img alt="mozactionhint.png" class="internal default" src="/@api/deki/files/4970/=mozactionhint.png?size=webview" style="width: 210px; height: 350px; border: 1px solid black;"></a></p>
<h2>Compatibility</h2>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
<table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Firefox (Gecko)</th> <th>Chrome</th> <th>Internet Explorer <a href="/#footnote-1" title="#footnote-1">[1]</a></th> <th>Opera</th> <th>Safari</th> </tr> <tr> <td>Basic support</td> <td>{{ CompatGeckoDesktop("1.7") }}</td> <td>1.0</td> <td>6 or earlier</td> <td>1.0</td> <td>1.0</td> </tr> <tr> <td>type</td> <td>{{ CompatGeckoDesktop("1.7") }}</td> <td> </td> <td>6</td> <td>1.0</td> <td> </td> </tr> <tr> <td>type=button</td> <td> </td> <td> </td> <td> </td> <td>1.0</td> <td> </td> </tr> <tr> <td> <p>type=checkbox</p> </td> <td>{{ CompatGeckoDesktop("1.9.2") }} for <code>indeterminate</code> value</td> <td> </td> <td> </td> <td>1.0</td> <td> </td> </tr> <tr> <td>type=color</td> <td>{{ CompatNo() }} <br> {{ unimplemented_inline("547004") }}</td> <td> </td> <td> </td> <td>11.01</td> <td> </td> </tr> <tr> <td>type=date</td> <td>{{ CompatNo() }}<br> {{ unimplemented_inline("446510") }}</td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>type=datetime</td> <td>{{ CompatNo() }}<br> {{ unimplemented_inline("446510") }}</td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>type=datetime-local</td> <td>{{ CompatNo() }}<br> {{ unimplemented_inline("446510") }}</td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>type=email</td> <td>{{ CompatGeckoDesktop("2.0") }}</td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>type=file</td> <td> </td> <td> </td> <td> </td> <td>1.0</td> <td> </td> </tr> <tr> <td>type=hidden</td> <td> </td> <td> </td> <td> </td> <td>1.0</td> <td> </td> </tr> <tr> <td>type=image</td> <td> </td> <td> </td> <td> </td> <td>1.0</td> <td> </td> </tr> <tr> <td>type=month</td> <td>{{ CompatNo() }}<br> {{ unimplemented_inline("446510") }}</td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>type=number</td> <td>{{ CompatNo() }}<br> {{ unimplemented_inline("344616") }}</td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>type=password</td> <td> </td> <td> </td> <td> </td> <td>1.0</td> <td> </td> </tr> <tr> <td>type=radio</td> <td>{{ CompatGeckoDesktop("1.9.2") }} for <code>indeterminate</code> value</td> <td> </td> <td> </td> <td>1.0</td> <td> </td> </tr> <tr> <td>type=range</td> <td>{{ CompatNo() }}<br> {{ unimplemented_inline("344618") }}</td> <td> </td> <td> </td> <td>10.62 (11.01 added support for a default value)</td> <td> </td> </tr> <tr> <td>type=reset</td> <td> </td> <td> </td> <td> </td> <td>1.0</td> <td> </td> </tr> <tr> <td>type=search</td> <td>{{ CompatGeckoDesktop("2.0") }}</td> <td> </td> <td> </td> <td>11.01</td> <td> </td> </tr> <tr> <td>type=submit</td> <td> </td> <td> </td> <td> </td> <td>1.0</td> <td> </td> </tr> <tr> <td>type=tel</td> <td>{{ CompatGeckoDesktop("2.0") }}</td> <td> </td> <td> </td> <td>11.01</td> <td> </td> </tr> <tr> <td>type=text</td> <td>{{ CompatGeckoDesktop("1.7") }}</td> <td> </td> <td> </td> <td>1.0</td> <td> </td> </tr> <tr> <td>type=time</td> <td>{{ CompatNo() }}<br> {{ unimplemented_inline("446510") }}</td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>type=url</td> <td>{{ CompatGeckoDesktop("2.0") }}</td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>type=week</td> <td>{{ CompatNo() }}<br> {{ unimplemented_inline("446510") }}</td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>accept=[MIME type]</td> <td>{{ CompatNo() }}<br> {{ unimplemented_inline("565274") }}</td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>accept=audio/*</td> <td>{{ CompatGeckoDesktop("2.0") }}<br> 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</td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>accept=video/*</td> <td>{{ CompatGeckoDesktop("2.0") }}<br> 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</td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>accept=image/*</td> <td>{{ CompatGeckoDesktop("2.0") }}<br> 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</td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>accesskey</td> <td> </td> <td> </td> <td> 6</td> <td>1.0</td> <td> </td> </tr> <tr> <td>mozactionhint</td> <td>{{ CompatGeckoDesktop("2.0") }}</td> <td>{{ CompatNo() }}</td> <td>{{ CompatNo() }}</td> <td>{{ CompatNo() }}</td> <td>{{ CompatNo() }}</td> </tr> <tr> <td>autocomplete</td> <td> </td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>autofocus</td> <td> </td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>checked</td> <td> </td> <td> </td> <td> 6</td> <td>1.0</td> <td> </td> </tr> <tr> <td>disabled</td> <td> </td> <td> </td> <td> 6</td> <td>1.0</td> <td> </td> </tr> <tr> <td>form</td> <td> </td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>formaction</td> <td>{{ CompatGeckoDesktop("2.0") }}</td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>formenctype</td> <td>{{ CompatGeckoDesktop("2.0") }}</td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>formmethod</td> <td>{{ CompatGeckoDesktop("2.0") }}</td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>formnovalidate</td> <td>{{ CompatGeckoDesktop("2.0") }}</td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>formtarget</td> <td>{{ CompatGeckoDesktop("2.0") }}</td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>height</td> <td>{{ CompatNo() }}</td> <td> </td> <td> </td> <td>1.0</td> <td> </td> </tr> <tr> <td>list</td> <td>{{ CompatGeckoDesktop("2.0") }}</td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>max</td> <td>{{ CompatNo() }}<br> {{ unimplemented_inline(<span><span>556010 }}</span></span></span>)</span></td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>maxlength</td> <td>{{ CompatGeckoDesktop("1.7") }}</td> <td> </td> <td> 6</td> <td>1.0</td> <td> </td> </tr> <tr> <td>min</td> <td> <p>{{ CompatNo() }}<br> {{ unimplemented_inline(<span><span>556010 }}</span></span></span>)</span></p> </td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>multiple</td> <td>{{ CompatGeckoDesktop("1.9.2") }} for <strong>type</strong>=file<br> {{ unimplemented_inline() }} for <strong>type</strong>=email</td> <td> </td> <td> </td> <td>11.01 (support for type=file and as of 11.01 type=email)</td> <td> </td> </tr> <tr> <td>name</td> <td>{{ CompatGeckoDesktop("1.7") }}</td> <td> </td> <td> </td> <td>1.0</td> <td> </td> </tr> <tr> <td>pattern</td> <td>{{ CompatGeckoDesktop("2.0") }}</td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>placeholder</td> <td> </td> <td> </td> <td> </td> <td>11.01</td> <td> </td> </tr> <tr> <td>readonly</td> <td> </td> <td> </td> <td> 6 (missing for <strong>type</strong> of <code>checkbox</code>, <code>radio</code>)</td> <td>1.0</td> <td> </td> </tr> <tr> <td>required</td> <td>{{ CompatGeckoDesktop("2.0") }}</td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>size</td> <td>{{ CompatGeckoDesktop("1.7") }}</td> <td> </td> <td> <p>6 (missing for <strong>type</strong> of <code>checkbox</code>, <code>radio, submit</code><code>, </code><code>reset, image, button</code>)</p> </td> <td>1.0</td> <td> </td> </tr> <tr> <td>src</td> <td> </td> <td> </td> <td>6</td> <td>1.0</td> <td> </td> </tr> <tr> <td>step</td> <td>{{ CompatNo() }}<br> {{ unimplemented_inline(<span><span>556009 }}</span></span></span>)</span></td> <td> </td> <td> </td> <td>10.62</td> <td> </td> </tr> <tr> <td>tabindex</td> <td> </td> <td> </td> <td>6 (elements with tabindex &gt; 0 are not navigated)</td> </tr> </tbody>
</table>
</div><h2>See also</h2>
<ul> <li>Other form-related elements: {{ HTMLElement("form") }}, {{ HTMLElement("button") }}, {{ HTMLElement("datalist") }}, {{ HTMLElement("legend") }}, {{ HTMLElement("label") }}, {{ HTMLElement("select") }}, {{ HTMLElement("optgroup") }}, {{ HTMLElement("option") }}, {{ HTMLElement("textarea") }}, {{ HTMLElement("keygen") }}, {{ HTMLElement("fieldset") }}, {{ HTMLElement("output") }}, {{ HTMLElement("progress") }} and {{ HTMLElement("meter") }}.</li> <li><a class=" external" href="http://webdesignerwall.com/tutorials/cross-browser-html5-placeholder-text" title="http://webdesignerwall.com/tutorials/cross-browser-html5-placeholder-text">Cross-browser HTML5 placeholder text</a></li>
</ul>
<p>{{ languages( { "fr": "fr/HTML/Element/input" } ) }}</p>
Revert to this revision