This page is Almost Ready

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

add

Summary

Adds an option element to the select element.

Method of dom/HTMLSelectElementdom/HTMLSelectElement

Syntax

 select.add(element, beforeElement);

Parameters

element

Data-type
DOM Node

The option element to add.

beforeElement

Data-type
DOM Node

The element before which the new option will be placed. If no value is given, the method places the element at the end of the collection.

Return Value

No return value

Usage

 This method adds an option element to a select block.

Notes

Before you can add an element to a collection, you must create it first by using the createElement method.

Related specifications

DOM Level 2 HTML
Recommendation

Attributions