Reputation: 10476
The following code works perfectly in non-IE browsers.
<select id="mySelect" name="mySelect">
<option value="1">MyVal1</option>
<option value="2">MyVal2</option>
<option value="3">MyVal3</option>
</select>
I'm trying to clear out the options so I can add new ones:
var mySelect = $("#mySelect");
mySelect.find("option").remove();
It works the first time I try to populate it, but then every subsequent time thereafter, it ignores me.
Upvotes: 1
Views: 598
Reputation: 66971
For removing options from a select, use .empty()
. Works better, cross-browser wise.
mySelect.empty();
Upvotes: 1