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>

 

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();

    formSelects.on('select_base_cityname', function (id,vals,val,isAdd,isDisabled) {
       
        var getName = layui.formSelects.value('select_base_cityname');//取值
        
        layer.msg("你选择的值为:" + getName);
    });

});

 

https://hnzzmsf.github.io/example/example_v4.html#options 

posted @ 2019-08-04 23:26  fdbnf  阅读(2981)  评论(0编辑  收藏  举报