Die remove()
-Methode der HTMLOptionsCollection
-Schnittstelle entfernt das durch den Index angegebene <option>
-Element aus dieser Sammlung.
index
Ein nullbasierter Ganzzahlindex für das HTMLOptionElement
in der HTMLOptionsCollection
. Wenn der Index nicht gefunden wird, hat die Methode keine Wirkung.
Keiner (undefined
).
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 Browser-Kompatibilität Siehe auch MDN-Feedback-Box War diese Ãbersetzung hilfreich?
Diese Seite wurde automatisch aus dem Englischen übersetzt.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4