layui select下拉框监听值变化 layui 下拉列表的change事件

匿名 (未验证) 提交于 2019-12-02 23:48:02
layui下拉列表的事件不能用jq的change 应该用自带的方式写

    1. form.on('select(filter)', function(data){
    2. console.log(data.elem); //得到select原始DOM对象
    3. console.log(data.value); //得到被选中的值
    4. console.log(data.othis); //得到美化后的DOM对象
    5. });

form.on('select(search_type)', function(data){     var html_one='<option value="1">充值</option><option value="2">还本付息</option>';     if(data.value == 1){         $("#search_detail").html(html_one);         form.render('select');     }else if(data.value == 2){         var html_two='<option value="3">提现</option><option value="4">购买产品</option>';         $("#search_detail").html(html_two);         form.render('select');//select是固定写法 不是选择器     }  }); 

lay-filter="search_type"

<div class="layui-form-item">                <label for="type" class="layui-form-label">                    <span class="x-red">*</span>所属地区                </label>                <div class="layui-input-inline">                    <select id="regionId" name="regionId" lay-verify="required|type" lay-filter="search_type">                    </select>                </div>            </div> 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!