标签:动态添加 col 动态 red option 选择 index 下拉 lte
data[{name:‘aa‘,age:18},{name:‘lisi‘,age:100},{name:‘zhangsan‘,age:80}]
html
<div class=‘layui-col-md3‘> <label class="layui-form-label">帅哥信息</label> <div class="layui-input-block"> <select id=‘aaa‘ lay-filter="aaa" class="layui-input " required="required"> </select> </div> </div>
js
//循环插入option数据数据
$.each(data, function(index, item) {
//赋值
$(‘#aaa‘).append(new Option(item.name, item.age));
});
//重新渲染select标签中的内容
layui.form.render("select");
标签:动态添加 col 动态 red option 选择 index 下拉 lte
原文地址:https://www.cnblogs.com/2070393244com/p/14026190.html