LayUI 多选框动态加载、启用、禁用、赋值、取值等js实现
例如多选框如下: <div class="layui-form"> <select xm-select="city"> </select> </div> 动态加载: var url = "加载路径"; View.get(url, "city=" + city, function(resp) { if (resp) { var html = ""; for (var i = 0; i < resp.length; i++) { html += "<option value='" + resp[i].key + "'>" + resp[i].value +"</option>"; } $("select[xm-select='city']").html(html); } layui.formSelects.render();// 重新渲染多选框 }, function() { }); 重新渲染多选框: layui.formSelects.render(); 例如多选框如下: <div class="layui-form"> <select name="city" xm-select="city_2"> <option value="1" selected="selected">北京</option> <option