Help Center

Local Navigation

Object: HTMLSelectElement

Availability

BlackBerry® Device Software version 4.6 or later

Extends

HTMLElement

The HTMLSelectElement object represents a <select> element in an HTML document.

The <select> element specifies a selection list. A selection list can be a single-selection or a multiple-selection list.

HTMLSelectElement properties

Property name

Type

Description

Status

Availability

disabled

boolean

When true, indicates that the form control is not available.

writable

4.6 or later

form

HTMLFormElement

Returns the form that contains the form control. If this element is not contained by a form, this property returns null.

read only

4.6 or later

length

int

Specifies the number of <option> elements the selection list contains.

writable

4.6 or later

multiple

boolean

When true, indicates that more than one option may be selected from the list.

writable

4.6 or later

name

String

Specifies the name of the form control. This is the name portion of the name-value pair that is submitted with the form.

writable

4.6 or later

options

HTMLOptionsCollection

Returns an index of the <option> elements contained within the selection list. Index positions begin at 0 and continue to HTMLOptionsCollection.length-1.

read only

4.6 or later

selectIndex

int

Specifies the index position of the selected option.

writable

4.6 or later

size

int

Specifies the number of visible rows.

writable

4.6 or later

tabIndex

int

Specifies the tabbing order of the form control.

writable

4.6 or later

type

String

Returns the type of form control. The value returned depends on the value of HTMLSelectElement.multiple:

  • When HTMLSelectElement.multiple has a value of “true”, the value for this property is “select-multiple”.

  • When HTMLSelectElement.multiple has a value of “false”, the value for this property is “select-one”.

read only

4.6 or later

value

String

Specifies the value of the currently selected option(s). This is the value portion of the name-value pair that is submitted with the form.

writable

4.6 or later

Methods

Method name

Description

add()

Adds a new option to the selection list.

blur()

Removes keypad focus from the element.

focus()

Gives keypad focus to the element.

remove()

Removes an option from the selection list.

Method: HTMLSelectElement.add()

Availability

BlackBerry® Device Software version 4.6 or later

The add() method adds a new option to the selection list.

If the before parameter is null, this method provides the same functionality as Node.appendChild(). Otherwise, this method functions the same as Node.insertBefore().

Syntax

HTMLSelectElement.add( element, before )

Parameters

Parameter

Type

Description

element

HTMLElement

The element to insert.

before

HTMLElement

The existing child element before which element is inserted.

If before is not specified or is null, element is inserted at the end of the list of children.

Return values

None.

Exceptions

Exception

Description

NOT_FOUND_ERR

This error is thrown if before is not a child of the <select> element.

Method: HTMLSelectElement.blur()

Availability

BlackBerry® Device Software version 4.6 or later

The blur() method removes keypad focus from the element.

Syntax

HTMLSelectElement.blur()

Parameters

None.

Return values

None.

Exceptions

None.

Method: HTMLSelectElement.focus()

Availability

BlackBerry® Device Software version 4.6 or later

The focus() method gives keypad focus to the element.

Syntax

HTMLSelectElement.focus()

Parameters

None.

Return values

None.

Exceptions

None.

Method: HTMLSelectElement.remove()

Availability

BlackBerry® Device Software version 4.6 or later

The remove() method removes an option from the selection list.

Syntax

HTMLSelectElement.remove( index )

Parameters

Parameter

Type

Description

index

int

The position in the HTMLSelectElement.options index of the element to remove from the selection list.

Return values

None.

Exceptions

None.


Was this information helpful? Send us your comments.