Selecting Option Based on Value

This question already has an answer here:

  • Change the selected value of a drop-down list with jQuery 15 answers

  • 只需在<select>标签上设置值即可:

    $('#options').val(userFont);
    

    $(function() {
      $("#options").val("three");
    });
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <select id="options">
      <option value="one">One</option>
      <option value="two" selected>Two</option>
      <option value="three">Three</option>
    </select>
    链接地址: http://www.djcxy.com/p/83914.html

    上一篇: 使用jQuery更改选定的选项

    下一篇: 基于价值选择期权