I am using Bootstrap-select plugin (https://silviomoreto.github.io/bootstrap-select/) for my dropdown select box. After I click a button, I want the box to refresh and the "selected" option to reset. This is the dropdown
<select id="dataPicker" class="selectpicker form-control">
<option value="default" selected="selected">Default</option>
<option value="one">One</option>
<option value="two">Two</option>
<option value="three">Three</option>
</select>
And this is my attempt at it, does not work. Any ideas on how it should be?
$("#dataPicker option:selected").val('default');
$("#dataPicker").selectpicker("refresh");
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…