HTMLOptionsCollection: remove()-Methode - Web-APIs | MDN
Syntax
Parameter
index-
Ein nullbasierter Ganzzahlindex für das
HTMLOptionElementin derHTMLOptionsCollection. Wenn der Index nicht gefunden wird, hat die Methode keine Wirkung.
Rückgabewert
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-Kompatibilität
Siehe auch
Help improve MDN
Erfahren Sie, wie Sie beitragen können Diese Seite wurde automatisch aus dem Englischen übersetzt.