Help Center

Local Navigation

HTML element: <input>

Availability

Partial support as of BlackBerry® Device Software version 3.7.

Full support as of BlackBerry Device Software version 4.6.

The <input> element defines a user input object. The BlackBerry® Browser renders <input> elements according to the value of the type attribute.

Differences between HTML, XHTML, and XHTML-MP

In HTML, the <input> element is not closed. To conform to XHTML (strict) or XHTML-MP, you must properly close the <input> element.

Attributes

Attribute

Value(s)

Description

Supported in

alt

text

When type=”image”, this attribute specifies the text that appears when an image is unavailable or cannot be displayed.

3.7 or later

checked

When type=”checkbox” or type=”radio”, if this attribute is specified, the check box or radio button appears selected, and its value is included when the form is submitted.

3.7 or later

maxlength

number

When type=”text” or type=”password”, this attribute specifies the maximum number of characters allowed in a text field.

3.7 or later

name

text

This attribute specifies a unique name for the input element.

This attribute is required, except with type=”submit” and type=”reset”.

3.7 or later

readonly

When type=”text” or “password”, if this attribute is specified, the value of a text field cannot be modified.

4.6 or later

size

length

This attribute specifies the size of the input element.

This attribute cannot be used with type=”hidden”.

4.6 or later

src

URI

When type=”image”, this attribute specifies the image that the browser displays.

4.6 or later

type

button

checkbox

file

hidden

image

password

radio

reset

submit

text

This attribute specifies the type of control added to the form. Possible values are defined as follows:

  • type=”button”: The element appears as a button. Use the value attribute to specify the text of the button.
  • type=“checkbox”: The element is rendered using a check box control. Check boxes can occur anywhere in a form element.
  • type=“file”: The associated file that appears is selectable and can be submitted with a form.
  • type=“hidden”: Hidden elements are not displayed, but they are included when the form is submitted.
  • type=“image”: The associated image that appears is selectable.
  • type=“password”: The browser displays an asterisk (*) for each character that the user types. The actual value is included in encoded form data when the form is submitted.
  • type=“radio”: The element is rendered using a radio control (a single selection option list). Radio input elements can appear anywhere in a form element.
  • type=“reset”: The element appears as a button. Users click the button to reset the form values to its original values. This does not affect other forms on the screen.
  • type=“submit”: The element appears as a submit button.
  • type=“text”: The element appears as a text input field.

3.7 or later

value

text

This attribute specifies the initial value of the input element. This attribute is required if type=”checkbox” or type=”radio”.

3.7 or later

Common attributes

The <input> element supports the following common attributes:

  • class
  • dir
  • id
  • lang
  • style
  • title

4.6 or later

Event attributes

The <input> element supports the following events:

  • onblur
  • onkeypress
  • onmouseover
  • onchange
  • onkeyup
  • onmouseup
  • onclick
  • onmousedown
  • onselect
  • onfocus
  • onmousemove
  • onkeydown
  • onmouseout

4.6 or later

Index


Was this information helpful? Send us your comments.