var sel = document.getElementById("MsgTmpId"); $("#TmpId").find("option").remove(); $.each(data.Data, function (index, item) { var opt = document.createElement("option"); opt.innerHTML = item.TemplateName; opt.value = item.Id; opt.setAttribute("varsList", item.VariableList); opt.setAttribute("templateContent", item.TemplateContent); sel.appendChild(opt); });
标签:opt,sel,option,js,item,var,动态,document From: https://www.cnblogs.com/feiqilai/p/16873654.html