是否有一種方法來在handle_result()中添加#dimensionName_和current_index的add_filter_Form?在jQuery函數調用中追加id?
我有以下代碼:
this.add_filter_form = function (name, value, status) {
form_count++;
current_index++;
form_status[current_index] = status;
$("#_IWID_Filters_included").append("<div id='filter_" + current_index + "'>" +
"Filter name: <select id = 'dimensionName_" + current_index + "'></select>" +
"Filter value: <select id ='dimensionId_" + current_index + "'></select>" +
"<button type='button' id='remove_btn_" + current_index + "' onclick='filter_forms.remove_filter_form(" + current_index + ")' style='margin-top: 5px; margin-bottom: 5px;'>Remove filter</button>" +
"</div>");
}
function handleResults(responseObj)
{
//Populates every dimensionName_[current_index] with names:
$("#dimensionName_").html(responseObj.DimensionListItem.map(function(item)
{
return $('<option>').text(item.dimensionDisplayName)[0];
}));
}
進出口尋找沿的效果的東西:
$("#'dimensionName_ + current_index'")
您能否澄清一下您需要的內容或發佈帶有虛擬值的簡單示例。 – user1853181
我更新了問題;給出的是我想要的,但該代碼顯然不工作:/ – Xenyal
因此,我們應該需要知道這些函數被稱爲 – Alex