您可以使用 .filter()以找到完全匹配,:包含选择器也返回部分匹配
You can use .filter() to find an exact match, :contains-selector returns partial matches also
var theText = "Large";
$("#size option").filter(function () {
return $.trim($(this).text()) == theText;
}).attr('selected', 'selected');
演示:小提琴