Defines an input element, such as a text field control or button, within a form.
Browser/User Agent Support
IE | Netscape | Mozilla | Opera | Safari | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
---|
Example
This example shows a form that collects a customer's name and phone number in two text input elements and has both submit and reset input elements:
<form action="thankyou.php" name="orderform" id="orderform" method="get"
onsubmit="return validate();"
onreset="return confirm('Clear all fields and reset form?');">
<input type="text" id="customerName" name="customerName" />
<input type="text" id="phoneNumber" name="phoneNumber" />
<br />
<input type="submit" name="Submit" id="submit" value="Submit" />
<input type="reset" name="Reset" id="reset" value="Reset" />
</form>
Remarks
Use the <textarea> </textarea> element for a multiline text input area, rather than <input type="textarea" /> if possible. Remember to self-close your <input /> tags.
Attribute Detail
Attribute | IE | Netscape | Mozilla | Opera | Safari |
---|---|---|---|---|---|
Specifies accepted MIME types for file uploads.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Hot-key shortcut for the element.
|
5.5+ | no | no | no | 1.0+ |
Defines the alignment of the element.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
alt
[text]. Example values (Usually a name/description of the element): "banner.gif", "cat.jpg", etc. Specifies alternative text to display if the element cannot be displayed as expected.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Specifies whether form autocompletion, which automatically completes the fields on a form after the user has typed enough letters, is on or off.
|
5.0+ | no | no | no | 1.0+ |
If present, specifies that the element should be checked.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
CSS class assigned to the element.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Direction of the element text.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Specifies whether or not the element is disabled.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
URL of a video clip file.
|
4.0+ | no | no | no | no |
Specifies whether the element shows a visual cue when it has focus.
|
5.5+ | no | no | no | no |
Number of pixels of space to the left and right of the element (i.e. horizontal margin).
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Unique identifier for the element.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Language code for the content of the element.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Script language for the element.
|
3.0+ | 2.0+ | 1.0+ | no | 1.0+ |
Number of times to loop the media file. Specify "infinite" for a continuous loop.
|
2.0+ | no | no | no | 1.0+ |
URL for a low-resolution version of an image.
|
4.0+ | no | no | no | no |
Maximum number of characters that a user may type into the element.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Unique name identifier for the element.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
If present, specifies that the element is read-only.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Size of the element.
|
2.0+ | 1.1+ | 1.0+ | 4.0+ | 1.0+ |
URL for the source for the element.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Inline style for the element.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Position of the element in the tabbing order for the document.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Short text description for the element.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Specifies the type of input control.
|
4.0+ | 1.0+ | 7.0+ | 1.0+ | |
Specifies whether or not the element is unselectable.
|
5.5+ | no | no | no | no |
Text containing the value of the element.
|
4.0+ | 1.1+ | 1.0+ | 7.0+ | 1.0+ |
Number of pixels of space above and below the element (i.e. vertical margin).
|
2.0+ | 1.0+ | 1.0+ | 7.0+ | 1.0+ |
Event Detail
Event | IE | Netscape | Mozilla | Opera | Safari |
---|---|---|---|---|---|
Fires when the loading of the element is cancelled before it finishes loading.
|
4.0+ | no | no | no | 1.0+ |
Fires when the element becomes active.
|
4.0+ | no | no | no | no |
Fires when the data from a datasource is successfully updated for a databound object.
|
4.0+ | no | no | no | no |
Fires immediately before the element becomes active.
|
4.0+ | no | no | no | no |
Fires immediately before the selection is copied to the clipboard.
|
4.0+ | no | no | no | 1.0+ |
Fires immediately before the selection is cut to the clipboard.
|
4.0+ | no | no | no | 1.0+ |
Fires immediately before the element stops being the active element.
|
4.0+ | no | no | no | no |
Fires immediately before the element receives focus prior to being edited.
|
4.0+ | no | no | no | no |
Fires immediately before the selection is pasted from the clipboard to the element.
|
4.0+ | no | no | no | 1.0+ |
Fires when the element loses focus.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when the value of the element changes.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when the element is clicked.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when the element is right-clicked and the context menu opens.
|
4.0+ | no | no | no | 1.0+ |
Fires immediately before the element is selected.
|
4.0+ | no | no | no | no |
Fires when the element is copied to the clipboard.
|
4.0+ | no | no | no | 1.0+ |
Fires when the element is cut to the clipboard.
|
4.0+ | no | no | no | 1.0+ |
Fires when the element is double-clicked.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when the active element becomes inactive.
|
4.0+ | no | no | no | no |
Fires when the element is dragged.
|
4.0+ | no | no | no | 1.0+ |
Fires when the element is released from being dragged.
|
4.0+ | no | no | no | 1.0+ |
Fires when the element has another object dragged onto it that can be dropped on the element.
|
4.0+ | no | no | no | 1.0+ |
Fires when an element has an object dragged out of it that could be dropped onto the element.
|
4.0+ | no | no | no | 1.0+ |
Fires when an element has an object dragged over it that could be dropped onto the element.
|
4.0+ | no | no | no | 1.0+ |
Fires immediately before an element is dragged.
|
4.0+ | no | no | no | 1.0+ |
Fires when an object is dropped onto the element.
|
4.0+ | no | no | no | 1.0+ |
Fires when an error occurs while updating the datasource of a databound object.
|
4.0+ | no | no | no | no |
Fires when the CSS Filter of an element changes or finishes transitioning.
|
4.0+ | no | no | no | no |
Fires when the element receives focus.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires immediately before an element receives focus.
|
4.0+ | no | no | no | no |
Fires immediately after focus moves from the element to another element.
|
4.0+ | no | no | no | no |
Fires when a user presses the F1 key to activate help.
|
4.0+ | no | no | no | no |
Fires when a user presses down on a key while the element has focus.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when a user presses a key or holds down the key while the element has focus.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when a user releases a key while the element has focus.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when the element loses mouse capture.
|
4.0+ | no | no | no | no |
Fires when a user clicks down on the mouse button while the element has focus.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when the mouse pointer enters the element.
|
4.0+ | no | no | no | no |
Fires when the mouse pointer leaves the element.
|
4.0+ | no | no | no | no |
Fires when the mouse moves while the pointer over the element.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when the mouse pointer moves off of the element.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when the mouse pointer moves over the element.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when the user releases the mouse button while the element has focus.
|
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ |
Fires when the user rotates the mouse wheel while the element has focus.
|
4.0+ | no | no | no | no |
Fires when the element moves.
|
4.0+ | no | no | no | no |
Fires when the element stops moving.
|
4.0+ | no | no | no | no |
Fires immediately before the element moves.
|
4.0+ | no | no | no | no |
Fires when the clipboard contents are pasted onto the element.
|
4.0+ | no | no | no | 1.0+ |
Fires when one of the properties of the element changes.
|
4.0+ | no | no | no | no |
Fires when the ready state of the element changes.
|
4.0+ | no | no | no | no |
Fires immediately before an element is about to be resized.
|
4.0+ | no | no | no | 1.0+ |
Fires when the element is finished being resized.
|
4.0+ | no | no | no | no |
Fires immediately before a user resizes the element.
|
4.0+ | no | no | no | no |
Fires immediately before the element is selected.
|
4.0+ | no | no | no | 1.0+ |
Fires when a time-related error occurs.
|
4.0+ | no | no | no | no |