我目前正在研究一段代码,它应该将选项附加到下拉列表中;引用的下拉列表未填充。
teamsDropDown = #id;
function loadDropDown(data, teamsDropDown)
{
var defaultValue;
teamsDropDown.find("option").remove();
var list = teamsDropDown;
jQuery.each(data, function(index, item) {
var listOptions = list;
listOptions[listOptions.length] = new Option(item.Name, item.Value.replace(new RegExp("'", "g"), "'"));
if (item.IsDefaultValue) {
defaultValue = item.Value;
}
});
teamsDropDown.val(defaultValue).attr("selected", "selected");
}
function HTMLOptionElementFactory (text, value, defaultSelected, selected) {
/// <signature>
/// <param name='text' type='String' optional='true' />
/// <param name='value' type='String' optional='true' />
/// <param name='defaultSelected' type='Boolean' optional='true' />
/// <param name='selected' type='Boolean' optional='true' />
/// </signature>
return Object.create(HTMLOptionElement);
}