标签:read hal readonly 选中 function form 选项 代码 filter
window.onload = function () {
var HallNameId = $("#HallNameId").val();
//console.log(HallNameId);
var select = ‘dd[lay-value=‘ + HallNameId + ‘]‘;
$(‘#hallName‘).siblings("div.layui-form-select").find(‘dl‘).find(select).click();
}
select
标签中,会被渲染为dd列表,此时,我们赋值select标签已无太大的意义,需要对dd列表中的值设置选中 <div class="layui-form-item">
<label class="layui-form-label">选项</label>
<div class="layui-inline layui-show-xs-block">
<select id="hallName" name="hallName" lay-filter="hallName">
<option value="1">请选择</option>
<option value="1">测试1</option>
<option value="1">测试2</option>
<option value="1">测试3</option>
</select>
<div class="layui-unselect layui-form-select">
<div class="layui-select-title">
<input type="text" placeholder="请选择" value="请选择" readonly="" class="layui-input layui-unselect">
<i class="layui-edge" />
</div>
<dl class="layui-anim layui-anim-upbit">
<dd lay-value="1" class="layui-this">请选择</dd>
<dd lay-value="1" class="layui-this">测试1</dd>
<dd lay-value="1" class="layui-this">测试2</dd>
<dd lay-value="1" class="layui-this">测试3</dd>
</dl>
</div>
</div>
</div>
标签:read hal readonly 选中 function form 选项 代码 filter
原文地址:https://www.cnblogs.com/kikyoqiang/p/12819837.html