0
我正在使用此方法将值和文本添加到选项,但我还需要添加选定的属性。我怎样才能做到这一点?这是我的方法...:如何使用JQuery select2()从下拉列表中选择属性?
$.each(items, function (i, item) {
$('#mySelect').append($('<option>', {
value: item.value,
text : item.text
// is it possible to add here something like this: select: "selected"
}));
});
我正在使用select2从jquery插件 – Chester
答案在这里http://stackoverflow.com/questions/19155264/get-attributes-values-from- SELECT2选择的选项 – Selvamani