formSelects 4.x多选下拉框

Posted hhthtt

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了formSelects 4.x多选下拉框相关的知识,希望对你有一定的参考价值。

需先引入:

formSelects-v4.css

formSelects-v4.js

插件下载地址:https://fly.layui.com/extend/formSelects

 

使用:

<div class="layui-form">
    <div class="layui-input-inline">
        <select name="select_base_cityname" id="select_base_cityname" lay-filter="select_base_cityname" xm-select="select_base_cityname" xm-select-type="1">
            <option value=""></option>
            <option value="1">北京</option>
            <option value="2">上海</option>
            <option value="3">天津</option>
            <option value="4">重庆</option>
        </select>
    </div>
<div class="layui-row ">
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
<button type="button" class="layui-btn layui-btn-danger" lay-submit lay-filter="btn_submit" id="btn_submit"><i class="layui-icon">&#xe681</i>获取</button>
</div>
</div>

 

layui.use([‘form‘, ‘layer‘, ‘jquery‘, ‘table‘, ‘laydate‘, ‘element‘, ‘upload‘, ‘flow‘], function ()
    var $$ = layui.jquery;
    var form = layui.form,
        layer = parent.layer == undefined ? layui.layer : parent.layer,
        //layer = layui.layer,
        table = layui.table,
        laydate = layui.laydate,
        element = layui.element,
        upload = layui.upload,
        flow = layui.flow;
    form.render();

    form.on(‘submit(btn_submit)‘, function (obj)
       
        var getName = JSON.stringify(layui.formSelects.value(‘select_base_cityname‘, ‘name‘));//取值name数组
        /*layer.msg("你选择的值为:" + getName, offset: ‘150px‘, icon: 1, time: 5000 , function ()                   
        );*/
        layer.msg("你选择的值为:" + getName);
    );

);

 

以上是关于formSelects 4.x多选下拉框的主要内容,如果未能解决你的问题,请参考以下文章

layui多选框

多选下拉框回显无内容

jQuery 多选下拉框插件

HTML多选下拉框怎么做

怎么让下拉框SELECT多选?

Angular实现虚拟滚动多选下拉框笔记