Select

The select form element can either be a pull-down menu or a scrollable list. The items in it are called the options of the select and are stored in the select element's options[] array.

Properties

length

FF, IE 3

Number of options in the select

multiple

FF, IE 4

If true, accept multiple selections in select box

name

FF, IE 3

select object's name

options[]

FF, IE 3

Read-only: Array containing the select's options. See "Option" on page 435 for more information.

selectedIndex

FF, IE 3

Contains the selected option's array position in a select element. If no item has been selected, selectedIndex is −1. If more than one option has been selected, selectedIndex contains the position of the first option. To determine all the options selected, use a loop to look ...

Get The Book of JavaScript, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.