Object: HTMLInputElement
Availability
|
BlackBerry®
Device Software version 4.6 or later
|
Extends
|
HTMLElement
|
The HTMLInputElement object represents an <input> element in an HTML document.
The <input> element defines a user input object.
HTMLInputElement properties
Property name
|
Type
|
Description
|
Status
|
Availability
|
accept
|
String
|
Specifies a comma-separated list of content types that this form accepts.
|
writable
|
4.6 or later
|
accessKey
|
String
|
Specifies the keypad key that gives access to the element.
|
writable
|
4.6 or later
|
align
|
String
|
Specifies the vertical or horizontal alignment of the image on the page.
|
writable
|
4.6 or later
|
alt
|
String
|
When HTMLInputElement.type has a value of image, specifies the text that appears when an image is unavailable or cannot be displayed.
|
writable
|
4.6 or later
|
checked
|
boolean
|
When true and HTMLInputElement.type has a value of checkbox or radio, indicates that the check box or radio button appears selected, and its value is included when the form is submitted.
|
writable
|
4.6 or later
|
defaultChecked
|
boolean
|
When true and HTMLInputElement.type has a value of checkbox or radio, indicates that the input control is initially selected.
The value of this property does not change if the state of the input control within the form changes.
|
writable
|
4.6 or later
|
defaultValue
|
String
|
When HTMLInputElement.type has a value other than button, checkbox, hidden,
image,
reset, or submit, specifies the initial value of the form control.
The value of this property does not change if the contents of the form control within the form changes.
|
writable
|
4.6 or later
|
disabled
|
boolean
|
When true, indicates that the form control is not available.
|
writable
|
4.6 or later
|
form
|
HTMLFormElement
|
Returns the parent <form> element for the form control.
|
read only
|
4.6 or later
|
list
|
HTMLElement
|
Returns the associated <datalist> element containing the list of value suggestions, if one exists. If no associated <datalist> element exists, this property returns null.
|
read only
|
4.7.1 or later
|
maxLength
|
int
|
When HTMLInputElement.type has a value of email, password, search, text, or url, specifies the maximum number of characters permitted as input into the text field.
|
writable
|
4.6 or later
|
name
|
String
|
Specifies the amount of whitespace padding added to the top and bottom of the image.
|
writable
|
4.6 or later
|
readonly
|
boolean
|
When HTMLInputElement.type has a value of of email, password, search, text, or url and this property is true, indicates that the form control cannot be modified by a user.
|
writable
|
4.6 or later
|
size
|
int
|
Specifies the size of the form control.
|
writable
|
4.6 or later
|
src
|
String
|
When HTMLInputElement.type has a value of image, specifies the URI of the source image.
|
writable
|
4.6 or later
|
tabIndex
|
int
|
Specifies the element’s position in the tabbing order.
|
writable
|
4.6 or later
|
type
|
String
|
Specifies the type of form control this input element is. This property may have the following values:
- button
- checkbox
- date (4.7.1 or later)
- datetime (4.7.1 or later)
- datetime-local (4.7.1 or later)
- email (4.7.1 or later)
- file
- hidden
- image
- month (4.7.1 or later)
- number (4.7.1 or later)
- password
- radio
- range (4.7.1 or later)
- reset
- search (4.7.1 or later)
- submit
- text
- time (4.7.1 or later)
- url (4.7.1 or later)
- week (4.7.1 or later)
|
writable
|
type-dependent
|
useMap
|
String
|
When HTMLInputElement.type has a value of image, specifies the client-side map to use with this image.
|
writable
|
4.6 or later
|
value
|
String
|
Specifies the current value of the form control. This is the value portion of the name-value pair that is submitted with the form.
|
writable
|
4.6 or later
|
valueAsDate
|
long
|
Specifies the value of the element interpreted as a date. The browser represents this number as the number of milliseconds elapsed from origin (Midnight UTC, the morning of January 1, 1970).
This property can be used with all date- and time-based input types, excluding the datetime-local input type.
|
writable
|
4.7.1 or later
|
valueAsNumber
|
float
|
Specifies the value of the element interpreted as a number.
This property can be used with the number and range input types.
|
writable
|
4.7.1 or later
|
HTMLInputElement methods
Method name
|
Description
|
Availability
|
blur()
|
Removes keypad focus from the element.
|
4.6 or later
|
click()
|
Simulates a mouse click.
|
4.6 or later
|
focus()
|
Gives keypad focus to the element.
|
4.6 or later
|
select()
|
Selects the contents of the element.
|
4.6 or later
|
stepDown()
|
Reduces the value of the form control element by the given value.
|
4.7.1 or later
|
stepUp()
|
Increases the value of the form control element by the given value.
|
4.7.1 or later
|
Method: HTMLInputElement.blur()
Availability
|
BlackBerry®
Device Software version 4.6 or later
|
The blur() method removes keypad focus from the element.
Syntax
HTMLInputElement.blur()
Method: HTMLInputElement.click()
Availability
|
BlackBerry®
Device Software version 4.6 or later
|
The click() method simulates a mouse click. This method can be used when HTMLInputElement.type
has a value of “button”, “checkbox”, “radio”, “reset”, or “submit”.
Syntax
HTMLInputElement.click()
Method: HTMLInputElement.focus()
Availability
|
BlackBerry®
Device Software version 4.6 or later
|
The focus() method gives keypad focus to the element.
Syntax
HTMLInputElement.focus()
Method: HTMLInputElement.select()
Availability
|
BlackBerry®
Device Software version 4.6 or later
|
The select() method selects the entire contents of the element. This method can be used when HTMLInputElement.type
has a value of “file”, “password”, or “text”.
Syntax
HTMLInputElement.select()
Method: HTMLInputElement.stepDown()
Availability
|
BlackBerry®
Device Software version 4.7.1 or later
|
The stepDown() method decreases the value of the form control by the specified value.
Syntax
HTMLInputElement.stepDown( increment
)
Parameters
Parameter
|
Type
|
Description
|
increment
|
long
|
Specifies the amount by which the value is decreased.
If the resulting value is less than the value of the element's min attribute, then HTMLInputElement.value is not changed.
|
Method: HTMLInputElement.stepUp()
Availability
|
BlackBerry®
Device Software version 4.7.1 or later
|
The stepUp() method increases the value of the form control by the specified value.
Syntax
HTMLInputElement.stepUp( increment
)
Parameters
Parameter
|
Type
|
Description
|
increment
|
long
|
Specifies the amount by which the value is increased.
If the resulting value is greater than the value of the element's max attribute, then HTMLInputElement.value is not changed.
|
Was this information helpful? Send us your comments.