9.5. The Input Tag

Many form fields share the same tag, namely the input (<input>) tag. This tag uses a type attribute to tell the user agent what type of field it signifies. The input tag is used for the following types of fields:

  • button

  • checkbox

  • file

  • hidden

  • image

  • password

  • radio

  • reset

  • submit

  • text

For example, the following two tags define a text field and a submit button:

<input type="text" name="username" id="username" size="30" />
<input type="submit" name="submit" id="submit" value="Submit" />

More information on the various fields supported by the input tag appears in appropriate sections later in this chapter.

Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.