JavaScript select object method: add()
[this page | pdf | back links]
The add() method of the JavaScript
DOM object
corresponding to the HTML <select>
element adds an option to a drop-down list.
It has the following
syntax with the following parameters:
object.add(option, index)
Parameter
|
Required / Optional
|
Description
|
option
|
Required
|
Option to be added
(needs to be an <option>
or an <optgroup>
element)
|
index
|
Optional
|
(default is 0). Index position
where new option element is inserted
|
NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)