INPUT HTML Element

From Appmethod Topics
Jump to: navigation, search

Go Up to HTML Elements Index

The INPUT element specifies a form input control and provides the following attributes and events.

Item Description

accept

Specifies a comma-separated list of content types that a server processing this form will handle correctly. User agents may use this information to filter non-conforming files when prompting a user to select files to be sent to the server.

accesskey

Assigns an access key to an element. An access key is a single character from the document character set. Authors should consider the input method of the expected reader when specifying an accesskey.

align

Specifies the horizontal alignment of its element with respect to the surrounding context. Possible values are left, right, center, and justify.

alt

For user agents that cannot display images, forms, or applets, this attribute specifies alternate text. The language of the alternate text is specified by the lang attribute.

checked

When the type attribute has the value radio or checkbox, this boolean attribute specifies that the button is on. User agents must ignore this attribute for other control types.

class

Assigns a class name or set of class names to an element. Any number of elements may be assigned the same class name or names. Multiple class names must be separated by white space characters.

dir

Specifies the direction of directionally neutral text in an element's content and attribute values:

  • ltr indicates left-to-right text or table.
  • rtl indicates right-to-left text or table.

disabled

When set for a form control, this boolean attribute disables the control for user input.

id

Assigns a name to an element. This name must be unique in a document.

ismap

For the IMG and INPUT elements, associates a server-side image map with the element.

lang

Specifies the base language of an element's attribute values and text content. The default value of this attribute is unknown.

maxlength

When the type attribute is set to text or password, this attribute specifies the maximum number of characters the user may enter. This number may exceed the specified size, in which case the user agent should offer a scrolling mechanism. The default value for this attribute is an unlimited number.

name

Assigns the control name.

onblur

The onblur event occurs when an element loses focus either by the pointing device or by tabbing navigation.

onchange

The onchange event occurs when a control loses the input focus and its value has been modified since gaining focus. This attribute applies to the following elements: INPUT, SELECT, and TEXTAREA.

onclick

The onclick event occurs when the pointing device button is clicked over an element.

ondblclick

The ondblclick event occurs when the pointing device button is double clicked over an element.

onfocus

The onfocus event occurs when an element receives focus either by the pointing device or by tabbing navigation.

onkeydown

The onkeydown event occurs when a key is pressed down over an element.

onkeypress

The onkeypress event occurs when a key is pressed and released over an element.

onkeyup

The onkeyup event occurs when a key is released over an element. This attribute may be used with most elements.

onmousedown

The onmousedown event occurs when the pointing device button is pressed over an element.

onmousemove

The onmousemove event occurs when the pointing device is moved while it is over an element.

onmouseout

The onmouseout event occurs when the pointing device is moved away from an element.

onmouseover

The onmousemove event occurs when the pointing device is moved while it is over an element.

onmouseup

The onmouseup event occurs when the pointing device button is released over an element.

onselect

The onselect event occurs when a user selects some text in a text field. This attribute may be used with the INPUT and TEXTAREA elements.

readonly

When set for a form control, this boolean attribute prohibits changes to the control.

size

Specifies the initial width of the control. The width is given in pixels except when type attribute is set to text or password. In that case, its value refers to the (integer) number of characters.

src

When the type attribute is set to image, this attribute specifies the location of the image to be used to decorate the graphical submit button.

style

Specifies style information for the current element. The syntax of the value of the style attribute is determined by the default style sheet language.

tabindex

Specifies the position of the current element in the tabbing order for the current document. This value must be a number between 0 and 32767. User agents should ignore leading zeros.

title

Specifies advisory information about the element for which it is set.

type

Specifies the type of control to create and can be set to:

  • button creates a push button. User agents should use the value of the value attribute as the button's label.
  • checkbox creates a checkbox.
  • file creates a file select control. User agents may use the value of the value attribute as the initial file name.
  • hidden creates a hidden control.
  • image creates a graphical submit button. The value of the src attribute specifies the URI of the image that will decorate the button. For accessibility reasons, authors should provide alternate text for the image via the alt attribute.
  • password creates a single-line text input control, but the input text is rendered to hide the characters (for example, a series of asterisks). This control type is often used for sensitive input such as passwords. Note that the current value is the text entered by the user, not the text rendered by the user agent.
  • radio creates a radio button.
  • reset creates a reset button.
  • submit creates a submit button.
  • text creates a single-line text input control.

usemap

Associates an image map with an element. The image map is defined by a MAP element. The value of usemap must match the value of the name attribute of the associated MAP element.

value

Specifies the initial value of the control. It is optional except when the type attribute has the value radio or checkbox.



See Also