How to remove item from dropdownlist in Javascript

Q & AHow to remove item from dropdownlist in Javascript
Admin Staff asked 4 years ago

How to remove item from dropdownlist in Javascript

1 Answers
Admin Staff answered 4 years ago

function removeitemfromdropdownlist()
{
    var len = document.getElementById(‘dropdownlistid’).options.length;
    for(i=len-1; i>=1; i–)
    {
    document.getElementById(‘dropdownlistid’).options.remove(i);
    }
}