layui获取下拉框选中的值
Posted on 2018年8月23日 By 618插件网
添加新的窗口<div class="citymd">
<ul>
<li>
<a onclick="openCityTab('/pc/plugin/pdf-js/web/viewer.html?name=${base}/pc/pdf_report/stateProfile_pdf/AmericaSurveyAnalysis.pdf','美国')">美国</a>
</li>
</ul></div>
var base = "${base}";
function openCityTab(url, title) {
top.larryTab.tabAdd({
title: title,
href: url
});
}
<form class="layui-form" action="">
<div class="layui-form-item layui-col-md3 ">
<label class="layui-form-label">请选择</label>
<div class="layui-input-block">
<select class="form-control input-sm" name="category" lay-filter="category" aria-invalid="false">
<option value="0">中国</option>
<option value="1">美国</option>
<option value="2">德国</option>
<option value="3">***</option>
<option value="4">中美德日</option>
</select>
</div>
</div>
</form>
layui.use('form', function () { var form = layui.form; var category = 0; var categoryName = '';
form.on('select(category)', function (data) {
category = data.value;
categoryName = data.elem[data.elem.selectedIndex].text;
form.render('select');
});
});