Quackit Logo

FREE Hosting!

With every domain name you register with ZappyHost, you get FREE hosting.

PLUS you get:

  • FREE Website Builder
  • FREE Blog
  • FREE Starter Web Page
  • FREE Email Account
  • & much more! (Total value $123 for FREE!)
Get your FREE hosting today! >>

HTML input Tag

Print Version

The information on this page is based on HTML version 4.01 (which is the current version of HTML). The next version, HTML 5, is currently being written. Here's a list of HTML 5 tags.

The HTML input tag is used within a form to declare an input element - a control that allows the user to input data.

The HTML 5 version of this tag introduces some new attributes.

Example
<form action="/html/tags/html_form_tag_action.cfm" method="get">
First name:
<input type="text" name="first_name" value="" maxlength="100" />
<br />
Last name:
<input type="text" name="last_name" value="" maxlength="100" />
<input type="submit" value="Submit" />
</form>

The above code produces the following input controls:

First name:
Last name:
Attributes:
Attributes specific to this tag:
AttributeDescription
typeSpecifies the type of control. Possible values:
  • text
  • password
  • checkbox
  • radio
  • submit
  • reset
  • file
  • hidden
  • image
  • button
nameAssigns a name to the input control.
valueSpecifies the intial value for the control. Note: If type="checkbox" or type="radio" this attribute is required.
sizeSpecifies the width of the control. If type="text" or type="password" this refers to the width in characters. Otherwise it's in pixels.
maxlengthSpecifies the maximum number of characters that the user can input. This can be bigger than the value indicated in the size attribute.
checkedIf type="radio" or type="checkbox" it will already be selected when the page loads.
srcIf type="image", this attribute specifies the location of the image.
Other Attributes:
AttributeDescription
classDocument wide identifier.
idDocument wide identifier
dirSpecifies the direction of the text
langLanguage code
titleSpecifies a title to associate with the element. Many browsers will display this when the cursor hovers over the element (similar to a "tool tip").
styleInline style (CSS)
alignFor alignment (left, center, right, justify).
altAlternate text. This specifies text to be used in case the browser/user agent can't render the input control.
acceptSpecifies a comma-separated list of content types that the server accepts.
readonlySets the input control to read-only - it won't allow the user to change the value. The control however, can receive focus and are included when tabbing through the form controls.
disabledDisables the input control. The button won't accept changes from the user. It also cannot receive focus and will be skipped when tabbing.
tabindexHelps determine the tabbing order (when the user 'tabs' through the elements on the page).
accesskeyAccess keys (or shortcut keys)
ismapFor image maps. See HTML map tag
usemapFor image maps. See HTML map tag
onfocusIntrinsic event (see event handlers)
onblurIntrinsic event (see event handlers)
onselectIntrinsic event (see event handlers)
onchangeIntrinsic event (see event handlers)
onclickIntrinsic event (see event handlers)
ondbclickIntrinsic event (see event handlers)
onmousedownIntrinsic event (see event handlers)
onmouseupIntrinsic event (see event handlers)
onmouseoverIntrinsic event (see event handlers)
onmousemoveIntrinsic event (see event handlers)
onmouseoutIntrinsic event (see event handlers)
onkeypressIntrinsic event (see event handlers)
onkeydownIntrinsic event (see event handlers)
onkeyupIntrinsic event (see event handlers)

Also see the HTML 5 version of HTML tags

Enjoy this website?

  1. Link to this page (copy/paste into your own website or blog):
  2. Add this page to your favorite social bookmarks sites:
               
  3. Add this page to your Favorites

Oh, and thank you for supporting Quackit!