代碼 $("#seachContinent").find("option[text='"+tds+"']").attr("selected",true) 中 tds 含前後空白導致匹配失敗。
var tds = $.trim($('#infor tr:eq(1) td:nth-child(7)').text()); // 用 .text() 而非 .html()
$("#seachContinent").find("option:contains('" + tds + "')").prop("selected", true);
// 或精確匹配 value
$("#seachContinent").val(tds);
.text() 獲取純文字,.html() 含標籤。$.trim() 移除首尾空白 (含 、換行)。.prop("selected", true) 優於 .attr("selected", true) (jQuery 1.6+)。option 有 value 屬性,直接 $(select).val(text) 最簡潔。