有人知道为什么在 Safari 中这不起作用吗?
$('#my_dropdown')
.find('option')
.filter(function(index) {
return $(this).text() === $('#country_of_residence').html();
}).prop("selected", true);
就像在 Chrome 和 Firefox 中一样。该选项确实被选中(因为有一个属性 selected="selected" 可见),但下拉列表没有更新。我正在使用 Safari 7.0.4。