如何在html選擇中動態地將值追加到optgroup中?謝謝。將值附加到optgroup
if (item.position == '/' + (currentPosition) + '/') {
$("#parentAgency").append(
$("<optgroup></optgroup>")
.val(item.level)
);
$("#parentAgency").append(
$("<option></option>")
.text(item.name)
.val(item.id)
);
currentPosition += 1;
}
的jsfiddle將是很好的,什麼是你所面臨的問題? –
我不能夠在OPTGROUP追加一個值標籤 – jpavlov