0
XML:插入XML來<select>
<Questions>
<Question>
<Id>1</Id>
<Text>aaa</Text>
<Reserver />
</Question>
<Question>
<Id>2</Id>
<Text>bbb</Text>
<Reserver />
</Question>
</Questions>
腳本
$(doc).find("Questions").each(function()
{
$('#s').
append($("<option></option>").
attr("value",$(this).find('Text').text()).
text($(this).find('Text').text()));
});
HTML
<select id="s">
<option></option>
</select>
我想補充'aaa'
和'bbb'
選擇在新這個名字的 「S」線。
但此代碼添加aaa bbb
選擇。