1. ホーム
  2. jquery

[解決済み] How to make the first option of <select> selected with jQuery

2022-02-05 13:30:39

Question

How do I make the first option of selected with jQuery?

<select id="target">
  <option value="1">...</option>
  <option value="2">...</option>
</select>

How to solved?

$("#target").val($("#target option:first").val());