Note: The add() method works correctly in IE8 or higher versions. To add a !DOCTYPE declaration in the page. For versions before IE 8, note the additional code.
[Try it Yourself Β»](#) * * *  ## More Examples (#) * * Select Object](#)Met Select Add
# Select add() Method
[ Select Object](#)
* * *
## Definition and Usage
The add() method is used to add an element to a .
## Syntax
selectObject.add(_option,before_)
| Parameter | Description |
| :--- | :--- |
| _option_ | Required. The option element to add. Must be an option or optgroup element. |
| _before_ | Required. The element in the options array before which the new element should be added. If this parameter is null, the element is added to the end of the options array. |
* * *
## Browser Support

The add() method is supported in all major browsers.
**Note:** The add() method requires a !DOCTYPE declaration in the page for IE8 and higher versions of IE.
* * *
## Example
## Example
The following example adds a "kiwi" option to the end of the dropdown list:
function displayResult(){
var x=document.getElementById("mySelect");
var option=document.createElement("option");
option.text="Kiwi";
try{
// For earlier versions of IE8
x.add(option,x.options);
}catch (e){
x.add(option,null);
}
}
Apple
Pear
Banana
Orange
YouTip