>[success] Layui的下拉选项初始化 ~~~ var item = $("#task_level").find("option"); $(item).each(function(e,obj){ var val = $(obj).attr("value"); console.log(val); console.log(res.level); if(val===res.level){ $(obj).attr("selected","selected"); }else{ $(obj).attr("selected",false); } }); form.render("select"); ~~~ >[success] 动态渲染选项 ``` // 渲染标签 layui.each(tags,function(index,item){ $("select#tags").append('<option value="'+item.id+'">'+item.title+'</option>'); }); form.render(); ``` >[success] 监听下拉 ``` //监听下拉 // html:<select name="category" lay-filter="category"> form.on('select(category)', function(data){ console.log("监听下拉"); }); ```