O'Reilly logo

HTML5 Pocket Reference, 5th Edition by Jennifer Niederst Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 type attribute is not in the Hidden state, then interactive content, palpable content, as well as “listed, labelable, submittable, and resettable form-associated content.” If the type attribute 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 file input type only.

alt="text"

Specifies alternative text for an image used as a button. Applies to the image input type.

autocomplete="on|off"

Not in HTML 4.01. Allows the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required