Answers for "how to remove all options from select in javascript"

3

remove all options from select jquery

$('#mySelect')
    .empty()
Posted by: Guest on March-18-2020
0

How to remove options from selectlist in javascript?

var selectobject = document.getElementById("mySelect");
for (var i=0; i<selectobject.length; i++) {
    if (selectobject.options[i].value == 'A')
        selectobject.remove(i);
}
Posted by: Guest on May-03-2020
0

How to remove options from selectlist in javascript?

<select id="mySelect" name="val" size="1" >
    <option value="A">Apple</option>
    <option value="C">Cars</option>
    <option value="H">Honda</option>
    <option value="F">Fiat</option>
    <option value="I">Indigo</option>                    
</select>
Posted by: Guest on May-03-2020

Code answers related to "how to remove all options from select in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language