[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/de/docs/Web/API/HTMLOptionsCollection/remove [Back]  [Original]

HTMLOptionsCollection: remove()-Methode - Web-APIs | MDN

Dieser Inhalt wurde automatisch aus dem Englischen bersetzt, und kann Fehler enthalten. Erfahre mehr ber dieses Experiment.

View in English Always switch to English

HTMLOptionsCollection: remove()-Methode

Die remove()-Methode der HTMLOptionsCollection-Schnittstelle entfernt das durch den Index angegebene <option>-Element aus dieser Sammlung.

In diesem Artikel

Syntax

js
remove(index)

Parameter

index

Ein nullbasierter Ganzzahlindex fr das HTMLOptionElement in der HTMLOptionsCollection. Wenn der Index nicht gefunden wird, hat die Methode keine Wirkung.

Rckgabewert

Keiner (undefined).

Beispiele

js
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

Spezifikationen

Spezifikation
HTML
# dom-htmloptionscollection-remove-dev

Browser-Kompatibilitt

Siehe auch


Web Proxy Viewer  |  New URL  |  Original Page