0

我想在列表中显示“正在加载”消息,而我的列表正在从 Flickr 加载标题。

我创建了一个<option>

<select name="select-choice-1" id="select-choice-1">
    <option>Loading...</option>
</select>

和我的 jquery 函数:

$.when(preload_titles()).done(function(){
    $("#select-choice-1 option:eq(1)").prop("selectedIndex",1);
    $("#select-choice-1").change();
});

但我无法在加载标题后将索引 1 处的选项“选中”。你知道如何进行这项工作吗?

谢谢

4

2 回答 2

1

改变

prop("selectedIndex",1)

prop("selected", true);
于 2012-03-07T20:55:44.730 回答
1

使用“选定”

 $("#select-choice-1 option:eq(1)").prop("selected",true);
于 2012-03-07T20:56:13.177 回答