根据传入的值选择选项

Fly*_*Cat 0 jquery

当我单击按钮时,我试图选择下拉菜单到特定选项

我有

HTML

   <select id='selectmenu'>
    <option>
    1
    </option>
    <option>
    2
    </option>
    <option>
    3
    </option>   

    </select>

    <a id='click'>click</a>
Run Code Online (Sandbox Code Playgroud)

jQuery的

  $('#click').click(function(){

      var option=3;
      //I want the select dropdown menu to select option 3 when I click the button. 
      //$('#selectmenu').select()  //I think it will be something like this....

    })
Run Code Online (Sandbox Code Playgroud)

谢谢您的帮助!

Nea*_*eal 5

$('#selectmenu').val(3); //p00f!
Run Code Online (Sandbox Code Playgroud)