首页 > 其他分享 >js 动态更新option

js 动态更新option

时间:2022-11-09 14:58:12浏览次数:49  
标签:opt sel option js item var 动态 document

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

相关文章