select下拉框
<select id="ZhiWuErJi" class="layui-input " type1="flow_select" isflow="1" required="required" name="ZhiWuErJi"> </select>
Js
$(window).load(function () { var q1 = document.getElementById("ZhiJi"); console.log(q1.options.length); for (var i = 0; i < q1.options.length; i++) { if (q1.options[i].value == "@info.ZhiJi") { q1.options[i].selected = true; } } //layui重新渲染 layui.use('form', function(){ var form = layui.form;//高版本建议把括号去掉,有的低版本,需要加() form.render('select'); //form.render(); });
==========================================================或者==============================================================
$("#ZhiWuErJi").val(值); //直接赋值
}