HTML:
<li class="layui-form">
<div class="layui-form-item">
<div class="layui-input-block">
<select name="CountryId" lay-filter="CountryId_select">
<option value="1" data-name="China">中国</option>
<option value="2" data-name="Cuba">古巴</option>
<option value="3" data-name="Russian Federation">俄罗斯</option>
</select>
</div>
</div>
</li>
JS代码:
<script src="js/jquery.min.js"></script>
<script src="layui/layui.all.js"></script>
layui.use(['upload', 'form'], function () {
var $ = layui.jquery,
upload = layui.upload,
form = layui.form,
layer = layui.layer;
//选择国家
form.on('select(CountryId_select)', function(data){
var CountryId = data.value; //国家id
var CountryEn = $(data.elem).find("option:selected").attr("data-name"); //国家英文名
});
})