input type=text – text-input field # T
The
input
element
with a type attribute whose
value is "text
" represents
a one-line plain text edit control for the
input
element’s value.
Permitted attributes #
-
global attributes
- Any attributes permitted globally.
-
name = string
#
- The name part of the name/value pair associated with this
element for the purposes of form submission.
-
disabled =
"disabled"
or "" (empty string) or empty
#
- Specifies that the element represents a disabled
control.
-
form =
ID reference
NEW
#
- The value of the
id
attribute on the
form
with which to associate the element.
-
type = "text"
#
- Specifies that its
input
element is
a one-line plain-text edit control for the
input
element’s value.
-
maxlength =
positive integer
#
- The maximum allowed value length of the element.
-
readonly =
"readonly"
or "" (empty string) or empty
#
- Specifies that element represents a control whose value
is not meant to be edited.
-
size =
positive integer
#
- The number of options meant to be shown by the control
represented by its element.
-
value = string
#
- Specifies a value for this
input
element.
-
autocomplete =
"on" or "off"
NEW
#
- Specifies whether the element represents an input
control for which a UA is meant to store the value entered
by the user (so that the UA can prefill the form
later).
-
autofocus =
"autofocus"
or "" (empty string) or empty
NEW
#
- Specifies that the element represents a control to which
a UA is meant to give focus as soon as the document is
loaded.
-
list =
ID reference
NEW
#
- The value of the
id
attribute on the
datalist
with which to associate the element.
-
pattern =
pattern
NEW
#
- Specifies a regular expression against which a UA is
meant to check the value of the control represented by its
element.
A regular expression that
must
match the JavaScript
Pattern
production as specified in
[ECMA 262].
-
required =
"required"
or "" (empty string) or empty
NEW
#
- Specifies that the element is a required part of form
submission.
-
placeholder = string NEW
#
- A short hint (one word or a short phrase) intended to
aid the user when entering data into the control
represented by its element.
Additional constraints and admonitions #
-
The interactive element input must not
appear as a descendant of the a element.
-
The interactive element input must not
appear as a descendant of the button element.
-
Any input element descendant of a label element
with a for attribute must have an
ID value that matches that for attribute.
-
The list attribute of the input element must refer to a datalist element.
-
Element input with attribute type
whose value is “button” must have non-empty attribute value.
-
The usemap attribute on the input element is obsolete.
Use the img element instead of the input element for image maps.
-
The align attribute on the input element is obsolete.
Use CSS instead.
Tag omission #
The
input
element is a void element.
An input
element must have a
start tag
but must not have an
end tag.
DOM interface #
interface HTMLInputElement : HTMLElement {
attribute DOMString accept;
attribute DOMString alt;
attribute DOMString autocomplete;
attribute boolean autofocus;
attribute boolean defaultChecked;
attribute boolean checked;
attribute DOMString dirName;
attribute boolean disabled;
readonly attribute HTMLFormElement form;
readonly attribute FileList files;
attribute DOMString formAction;
attribute DOMString formEnctype;
attribute DOMString formMethod;
attribute boolean formNoValidate;
attribute DOMString formTarget;
attribute DOMString height;
attribute boolean indeterminate;
readonly attribute HTMLElement list;
attribute DOMString max;
attribute long maxLength;
attribute DOMString min;
attribute boolean multiple;
attribute DOMString name;
attribute DOMString pattern;
attribute DOMString placeholder;
attribute boolean readOnly;
attribute boolean required;
attribute unsigned long size;
attribute DOMString src;
attribute DOMString step;
attribute DOMString type;
attribute DOMString defaultValue;
attribute DOMString value;
attribute Date valueAsDate;
attribute double valueAsNumber;
readonly attribute HTMLOptionElement selectedOption;
attribute DOMString width;
void stepUp(in optional long n);
void stepDown(in optional long n);
readonly attribute boolean willValidate;
readonly attribute ValidityState validity;
readonly attribute DOMString validationMessage;
boolean checkValidity();
void setCustomValidity(in DOMString error);
readonly attribute NodeList labels;
void select();
attribute unsigned long selectionStart;
attribute unsigned long selectionEnd;
void setSelectionRange(in unsigned long start, in unsigned long end);
};