Esta tradução está incompleta. Por favor, ajude a traduzir este artigo.
O elemento de HTML
<input type="date"> é uma versão específica do elemento
<input> usado para criar um campo de entrada (input) aceitando a data.
Navegadores generate a control for entering, and changing, the date. This date includes a year, month and day. The control itself varies from one browser to another; browsers not supporting this type will display a simple text control.
|Categoria do Conteúdo||Flow content, listed, submittable, resettable, form-associated element, phrasing content, labellable element, palpable content.|
|Conteúdo permitido||None, it is an empty element.|
|Tag omission||Must have a start tag and must not have an end tag.|
|Permitted parent elements||Any element that accepts phrasing content.|
Beside the attributes listed below, this element can have any of the global attributes.
- Specifies an "action hint" used to determine how to label the enter key on mobile devices with virtual keyboards. Supported values are
send; these automatically get mapped to the appropriate string (and are case-insensitive).
- 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).
This Boolean attribute indicates that the form control is not available for interaction. In particular, the
clickevent will not be dispatched on disabled controls. Also, a disabled control's value isn't submitted with the form.
- The form element that the input element is associated with (its form owner). The value of the attribute must be an id of a
<form>element in the same document. If this attribute is not specified, this
<input>element must be a descendant of a
<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.
- 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
actionattribute of the element's form owner.
- 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
<input>element with the
typeattribute set to
If this attribute is specified, it overrides the
enctypeattribute of the element's form owner.
- 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
methodattribute of the element's form owner.
- 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
novalidateattribute of the element's form owner.
- 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
targetattribute 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
_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
- A hint to the browser for which keyboard to display. This attribute applies when the value of the type attribute is text, password, email, or url. Possible values are:
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.
url: URL input. Use <input type="url"> if possible instead.
- Identifies a list of pre-defined options to suggest to the user. The value must be the id of a
<datalist>element in the same document. The browser displays only options that are valid values for this input element.
- The maximum value for this item, which must not be less than its minimum (min attribute) value.
- The minimum value for this item, which must not be greater than its maximum (max attribute) value.
- The name of the control, which is submitted with the form data.
- This Boolean attribute indicates that the user cannot modify the value of the control.
- This attribute specifies that the user must fill in a value before submitting a form. It cannot be used when the type attribute is
image, or a button type (
:requiredCSS pseudo-classes will be applied to the field as appropriate.
- The direction in which selection occurred. This is "forward" if the selection was made from left-to-right in an LTR locale or right-to-left in an RTL locale, or "backward" if the selection was made in the opposite direction. This can be "none" if the selection direction is unknown.
- Setting the value of this attribute to
trueindicates that the element needs to have its spelling and grammar checked. The value
defaultindicates that the element is to act according to a default behavior, possibly based on the parent element's own
spellcheckvalue. The value
falseindicates that the element should not be checked.
- 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
anyor 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.
- The initial value of the control. This attribute is optional.
Note that when reloading the page, Gecko and IE will ignore the value specified in the HTML source, if the value was changed before the reload.
- This Mozilla extension allows you to specify the error message to display when a field doesn't successfully validate.
To create a widget to display a date, use:
Fix me: Insert Browser Compatibility and specification tables here.