我如何使第一个选项的选择与jQuery?

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

当前回答

$("#target").val(null);

镀铬加工得很好

其他回答

Use:

$("#selectbox option:first").val()

请在这个JSFiddle中找到工作简单。

$('#newType option:first').prop('selected', true);

如果您有禁用选项,您可以添加not([disabled])以防止选择它们,结果如下:

$("#target option:not([disabled]):first").attr('selected','selected')

就像这样简单:

$('#target option:first').prop('selected', true);

虽然每个函数可能都不是必需的…

$('select').each(function(){
    $(this).find('option:first').prop('selected', 'selected');
});

对我有用。