Organizational Research By

Surprising Reserch Topic

How do you remove all the options of a select box and then add one option and select it with jQuery?


Using core jQuery, how do you remove all the options of a select box, then add one option and select it?

My select box is the following.

0 votes
37 views



Related Hot Questions

2 Answers

0 votes
$('#mySelect')
    .find('option')
    .remove()
    .end()
    .append('')
    .val('whatever')
;
answered May 20, 2015 by rahulgii
0 votes
$('#mySelect')
    .empty()
    .append('')
;
answered May 20, 2015 by rahulgii

...