layui select 下拉多选 xm-select

浪淘沙1年前前端125
<div class="layui-fluid">
    <div id="demo1" class="xm-select-demo"></div>
    <button class="layui-btn" id="demo1-getValue">获取选中值</button>
    <pre id="demo1-value"></pre>

</div>
<script>
    layui.config({
        base: '/layui/' // 静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use('index',
        function () {
            var $ = layui.jquery;
            var form = layui.form;
            var demo1 = xmSelect.render({
	        el: '#demo1', 
	        language: 'zn',
	        data: [
		        {name: '张三', value: 1},
		        {name: '李四', value: 2},
		        {name: '王五', value: 3},
	        ]
           });
            document.getElementById('demo1-getValue').onclick = function(){
	            //获取当前多选选中的值
	            var selectArr = demo1.getValue();
	            document.getElementById('demo1-value').innerHTML = JSON.stringify(selectArr, null, 2);
            }

     });
</script>


相关文章

layui table后端接口html代码,前端显示

  , { field: 'dwbq', title: '单位标签', width:&n...

layui 静态表格弹出传值、弹出页面

layui 静态表格弹出传值、弹出页面

<script>     layui.config({     base: '/lay...

layui多级表头,行高,序号,fixed固定对不齐问题

layui多级表头,行高,序号,fixed固定对不齐问题

<style>             /* 表头文字垂...

layui 表单 label宽度

 <style>      .layui-form-label {     ...

layui 为CKEditor 4 赋值 经常不显示

 // 在编辑器初始化后赋值  setTimeout(function() {   CKEDITOR.instances[...

asp.net code webapi layui ajax post表单数据

using System; using System.Collections.Generic; using System.Linq; using Syst...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。