首先,那个选择器非常慢。它将扫描每个 DOM 元素寻找 ID。如果可以为元素分配一个类,那么性能损失就会小一些。
$(".myselect")
不过,为了回答您的问题,有几种方法可以更改 jQuery 中的 select 元素值
// sets selected index of a select box to the option with the value "0"
$("select#elem").val('0');
// sets selected index of a select box to the option with the value ""
$("select#elem").val('');
// sets selected index to first item using the DOM
$("select#elem")[0].selectedIndex = 0;
// sets selected index to first item using jQuery (can work on multiple elements)
$("select#elem").prop('selectedIndex', 0);