Input element on an HTML form.
Platform Support
| IE | Mozilla | Netscape | Opera | Chrome | Safari | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|---|
Constructors
| Constructor | Action | IE | Mozilla | Netscape | Opera | Chrome | Safari | ||
|---|---|---|---|---|---|---|---|---|---|
|
Input Constructor() : Input
Creates a new instance of an Input object.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ | ||
Input() : InputCreates a new instance of an Input object. Returns
|
|||||||||
Properties
| Property | Action | IE | Mozilla | Netscape | Opera | Chrome | Safari |
|---|---|---|---|---|---|---|---|
|
name
: String
Name of the element.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|||||||
|
onblur
: Function
Event handler for when focus is moved off the element.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|||||||
|
onchange
: Function
Event handler for when a user changes makes a change element and moves focus off the element.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|||||||
|
onclick
: Function
Event handler for when a user clicks on the element.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|||||||
|
onfocus
: Function
Event handler for when a user gives focus to the element.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|||||||
|
type
: String
Type of form element the input element is.
|
Show Details | 3.0+ | 1.0+ | 3.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|||||||
|
value
: String
Value of the element when the form is submitted.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|||||||
|
checked
: Boolean
If the element is a radio button or checkbox, specifies whether or not the element is checked.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|||||||
|
defaultChecked
: Boolean
If the element is a radio button or checkbox, specifies whether or not the element is checked by default.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|||||||
|
defaultValue
: String
Specifies the default value for the element text.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|||||||
|
form
: String
Reference to the form that contains the element.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|||||||
|
Number of options in the options array for the element.
|
No Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|
|||||||
|
If the element is a Select list, specifies the list of options (as an array) for the element.
|
No Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|
|||||||
|
If the element is a Select list, specifies the index of the selected option in the options array.
|
No Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|
|||||||
Functions
| Method | Action | IE | Mozilla | Netscape | Opera | Chrome | Safari | ||
|---|---|---|---|---|---|---|---|---|---|
|
blur() : Object
Removes focus from the element.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ | ||
|
Returns
|
|||||||||
|
click() : Object
Simulates a mouse click on the element. Does not invoke the onClick event handler.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ | ||
|
Returns
|
|||||||||
|
focus() : Object
Gives focus to the element.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ | ||
|
Returns
|
|||||||||
|
select() : Object
Selects the text of the element, if applicable.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ | ||
|
Returns
|
|||||||||
References
Button|Checkbox|FileUpload|Form|Hidden|Password|Radio|Reset|Select|Submit|Text|Textarea|HTMLInputElement
Availability
JavaScript 1.0|enhanced in JavaScript 1.1|HTML DOM Level 1|W3C