input type="text" ElementThe input type="text" element is an inline element declared by the XHTML 1.1 Forms Module
Elements in the Forms Module are:form | label | textarea | select | optgroup | option | button | fieldset | legend | input type="button" | input type="checkbox" | input type="file" | input type="hidden" | input type="image" | input type="password" | input type="radio" | input type="reset" | input type="submit" | input type="text"
The input type="text" element is used within a
form to provide a single-line text
box in which the user may enter a short length of text. The width of the text
box may be specified using the
size attribute.
The maxlength
attribute may be used to specify the maximum number of characters which the user
is allowed to enter. The user agent should prevent the user from entering more
characters than this maximum number. Note, however, that processing code should
not assume that
it will never receive a value longer than this: quite apart from anything else,
it is far from difficult to submit arbitrary input data to your processor
without using a conventional browser.
The content of the
value attribute
(if present) is placed in the text box
when the form is first rendered. The user may then edit
the text (provided the element is not
disabled or
readonly)
and the final edited text is sent to
the processing URI as the value in a name=value pair.
Here is an example using the input type="text" element:
<label for="uname">Username:</label>
<input type="text" id="uname" name="uname" size="15" maxlength="12" value="Your username" />
This renders as:
See also the textarea element
for the input of long blocks of text and the
input type="password" element for
the input of short text which should be visually hidden from any onlookers
(as the name suggests, this is intended for password entry).
There are no #REQUIRED attributes on the input type="text" element.
input type="text" element are listed below:The type attribute is not #REQUIRED
on the input element and so, because its default value is "text", it does not need
to be present on input type="text".
accesskey [ type Character ]input element to allow text inputdisabled [ type Boolean ]maxlength [ type Number ]name [ type CDATA ]name attribute is not present, the value of the text field will not be sent). The value sent (in a name=value pair) is the text in the input field at the time of submission.Note: Although technically optional, a note in the *Forms Module DTD says that the name attribute is required on all input elements except "submit" and "reset"
readonly [ type Boolean ]size [ type Number ]tabindex [ type Number ]value [ type CDATA ]onblur [ type Script ]onchange [ type Script ]onfocus [ type Script ]onselect [ type Script ]input type="text" element are listed below:class [ type NMTOKENS ]id [ type ID ]style [ type CDATA ], from the Style Attribute Module (deprecated)title [ type Text ]xmlns [ type URI - #FIXED 'http://www.w3.org/1999/xhtml' ]dir [ type Enumeration (ltr | rtl) ], from the Bi-directional Text Modulexml:lang [ type LanguageCode ]All attributes in the
Events Attribute Collection
are supported:onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
input type="text" element is:
EMPTY
See Content Model & Nesting for information about Content Model syntax and Nesting Groups.
input type="text"This element is empty and may have no children.
input type="text"abbr, acronym, address, cite, code, dfn, div, em, h1 - h6, kbd, p, q, samp, span, strong, varadd, dt, licaption, td, thfieldset, label, legendb, big, i, small, sub, sup, ttdel, insbdoobjectrb, rt