The HTMLSelectElement.remove()
method removes the element at the specified index from the options collection for this select element.
collection.remove(index);
HTMLOptionElement
to remove from the collection. If the index is not found the method has no effect.var sel = document.getElementById("existingList"); sel.remove(1); /* Takes the existing following select object: <select id="existingList" name="existingList"> <option value="1">Option: Value 1</option> <option value="2">Option: Value 2</option> <option value="3">Option: Value 3</option> </select> And changes it to: <select id="existingList" name="existingList"> <option value="1">Option: Value 1</option> <option value="3">Option: Value 3</option> </select> */
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'HTMLSelectElement.remove()' in that specification. | Living Standard | |
HTML5 The definition of 'HTMLSelectElement.remove()' in that specification. | Recommendation | Is a snapshot of HTML Living Standard. |
Document Object Model (DOM) Level 2 HTML Specification The definition of 'HTMLSelectElement.remove()' in that specification. | Obsolete | |
Document Object Model (DOM) Level 1 Specification The definition of 'HTMLSelectElement.remove()' in that specification. | Obsolete | Initial definition. |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | Yes | Yes | Yes | Yes | Yes | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes | Yes | Yes | Yes | Yes | ? | ? |
ChildNode.remove
, the method that gets called when remove is called without arguments on a HTMLSelectElement
.HTMLSelectElement
that implements it.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/remove