Firefox Tomorrow

web api instance method

HTMLOptionsCollection: remove() method

View on MDN ↗

The remove() method of the HTMLOptionsCollection interface removes the <option> element specified by the index from this collection.

Syntax

remove(index)

Parameters

Return value

None (undefined).

Examples

const optionList = document.querySelector("select").options;
const listLength = optionList.length;
optionList.remove(listLength - 1); // removes the last item
optionList.remove(0); // removes the first item

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also