input (HTML element)

Depr. Empty Version
No Yes HTML 2
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+ CH2+
Full Full Full Full Full


<input name="string" type=" { button | checkbox | file | hidden | image | password | radio | reset | submit | text } " value="value" />


Describing the input element simply is not straightforward, as there is much variation in the way an input appears—and the attributes it uses or requires—depending on the type attribute specified. But whatever the type, the feature that’s common to all input elements is that they allow users to enter data.

The specific features of each kind of input are covered in the type attribute section of this reference. Other type-specific attributes are indicated as such in their own sections.

In addition to the standard attributes listed in the syntax section, there is another attribute that you might come across that is IE-specific, autocomplete with values of "on" or "off". As its name might suggest, the intention is to allow the browser to remember and complete form fields for you. However, because it is not cross-browser safe and is also ignored anyway under certain circumstances (if the page was delivered over HTTPS or was delivered with headers or a META tag that prevents caching), it is not the most useful/reliable attribute to use on form inputs.


Here’s a simple text input (see type for other input examples):

  <label for="firstname">First name</label>
  <input type="text" name="firstname" id="firstname"/>

Use This For …

The input element is used to capture user information. The kind of control that’s used will vary on a case-by-case basis, as explained in type.


Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full

It causes no compatibility issues, and has excellent support across all tested browsers.

In this Section

User-contributed notes

Related Products