Name
input
Synopsis
<input> (XHTML:
<input/> or <input
/>)
The input element is used to create a variety of form input controls. The
type of control is defined by the type attribute.
Following is a complete list of attributes (with descriptions) that
can be used with the input element. Not all
attributes can be used with all control types. The attributes
associated with each control type are listed below.
Usage
- Categories:
Flow content, phrasing content. If the
typeattribute is not in the Hidden state, then interactive content, palpable content, as well as “listed, labelable, submittable, and resettable form-associated content.” If thetypeattribute is in the Hidden state, then “listed, submittable, and resettable form-associated content.”- Permitted contexts:
Where phrasing content is expected
- Permitted content:
Empty
- Start/end tags:
This is an empty (void) element, meaning it has only a start tag and may not have any contents. In HTML, the end tag is forbidden. In XHTML, the element must be closed with a trailing slash (
<input/>or<input />).
Attributes
HTML5 Global Attributes
accept="MIME type"Specifies a comma-separated list of content types that a server processing the form will handle correctly. It can be used to filter out nonconforming files when prompting a user to select files to send to the server. Applies to the
fileinput type only.alt="text"Specifies alternative text for an image used as a button. Applies to the
imageinput type.autocomplete="on|off"Not in HTML 4.01. Allows the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access