Select remove() Method - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Select


The remove() method removes an option from a drop-down list.

Parameter Values

Parameter Description
index Required. index of the option to remove. Index starts at 0

Return Value:

No return value

The following code shows how to Remove the selected option from the drop-down list:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<select id="mySelect" size="4">
</select>/*from ww w  . j  a  v  a  2  s. co m*/

<button onclick="myFunction()">Remove last option</button>

function myFunction() {
    var x = document.getElementById("mySelect");
    if (x.length > 0) {


Related Tutorials