<small id='XQWkR'></small><noframes id='XQWkR'>

    <bdo id='XQWkR'></bdo><ul id='XQWkR'></ul>
  • <i id='XQWkR'><tr id='XQWkR'><dt id='XQWkR'><q id='XQWkR'><span id='XQWkR'><b id='XQWkR'><form id='XQWkR'><ins id='XQWkR'></ins><ul id='XQWkR'></ul><sub id='XQWkR'></sub></form><legend id='XQWkR'></legend><bdo id='XQWkR'><pre id='XQWkR'><center id='XQWkR'></center></pre></bdo></b><th id='XQWkR'></th></span></q></dt></tr></i><div id='XQWkR'><tfoot id='XQWkR'></tfoot><dl id='XQWkR'><fieldset id='XQWkR'></fieldset></dl></div>
    <legend id='XQWkR'><style id='XQWkR'><dir id='XQWkR'><q id='XQWkR'></q></dir></style></legend>

      1. <tfoot id='XQWkR'></tfoot>

        layui从数据库中获取复选框的值并默认选中方法

        layui从数据库中获取复选框的值并默认选中,详细代码: !doctype htmlhtml lang="en"headmeta charset="UTF-8"title/titlelink rel="stylesheet" type="text/css"href="../../../static/js/css/layui.css" rel="external nofollow" media="all"link rel="styl

        <i id='rNitO'><tr id='rNitO'><dt id='rNitO'><q id='rNitO'><span id='rNitO'><b id='rNitO'><form id='rNitO'><ins id='rNitO'></ins><ul id='rNitO'></ul><sub id='rNitO'></sub></form><legend id='rNitO'></legend><bdo id='rNitO'><pre id='rNitO'><center id='rNitO'></center></pre></bdo></b><th id='rNitO'></th></span></q></dt></tr></i><div id='rNitO'><tfoot id='rNitO'></tfoot><dl id='rNitO'><fieldset id='rNitO'></fieldset></dl></div>
        <tfoot id='rNitO'></tfoot>

                  <tbody id='rNitO'></tbody>
              1. <small id='rNitO'></small><noframes id='rNitO'>

                  <bdo id='rNitO'></bdo><ul id='rNitO'></ul>

                • <legend id='rNitO'><style id='rNitO'><dir id='rNitO'><q id='rNitO'></q></dir></style></legend>
                  layui数据库中获取复选框的值并默认选中,详细代码:
                  <!doctype html>
                  
                  <html lang="en">
                  <head>
                  <meta charset="UTF-8">
                  <title></title>
                  <link rel="stylesheet" type="text/css"
                  href="../../../static/js/css/layui.css" rel="external nofollow" media="all">
                  <link rel="stylesheet" type="text/css"
                  href="../../../static/css/index-gb.css" rel="external nofollow" media="all">
                  <link rel="stylesheet"
                  href="http://at.alicdn.com/t/font_563459_gq4dpdw2k61xajor.css" rel="external nofollow" />
                  <style>
                  #node input[type=checkbox] {
                  display: inline;
                  }
                  </style>
                  </head>
                  <body>
                  <div class="div-con">
                  <form class="layui-form layui-form1">
                  <input type="hidden" name="roleid" id="id" value="#(role.roleid ??)">
                  <div class="layui-form-item form-item1">
                  <label class="layui-form-label form-label1">角色名称</label>
                  <div class="layui-input-block input-block1">
                  <input value="#(role.name)" type="text" name="name"
                  autocomplete="off" placeholder="请输入角色名称"
                  class="layui-input layui-input1">
                  </div>
                  </div>
                  <div class="layui-form-item form-item1">
                  <label class="layui-form-label form-label1">角色描述</label>
                  <div class="layui-input-block input-block1">
                  <textarea value="#(role.description)" name="description" id=""
                  cols="30" rows="10" class="layui-textarea textarea-me"
                  placeholder="请输入角色描述"></textarea>
                  </div>
                  </div>
                  <div class="layui-form-item form-item1">
                  <label class="layui-form-label form-label1">菜单权限</label>
                  <div class="layui-input-block input-block4">
                  <input type="checkbox" name="functional" lay-skin="primary"
                  value="接待人员管理" title="接待人员管理"> <input type="checkbox"
                  name="functional" lay-skin="primary" value="接待车辆管理" title="接待车辆管理">
                  <input type="checkbox" name="functional" lay-skin="primary"
                  value="来访信息录入" title="来访信息录入"> <input type="checkbox"
                  name="functional" lay-skin="primary" value="我的待办" title="我的待办">
                  <input type="checkbox" name="functional" lay-skin="primary"
                  value="人员接待统计" title="人员接待统计"> <input type="checkbox"
                  name="functional" lay-skin="primary" value="园区接待统计" title="园区接待统计">
                  <input type="checkbox" name="functional" lay-skin="primary"
                  value="角色管理" title="角色管理"> <input type="checkbox"
                  name="functional" lay-skin="primary" value="用户管理" title="用户管理">
                  <input type="checkbox" name="functional" lay-skin="primary"
                  value="接待礼遇管理" title="接待礼遇管理"> <input type="checkbox"
                  name="functional" lay-skin="primary" value="操作日志" title="操作日志">
                  <input type="checkbox" name="functional" lay-skin="primary"
                  value="登录日志" title="登录日志">
                  </div>
                  </div>
                  <div class="layui-form-item form-item-btn">
                  <div class="layui-input-block layui-input-block5">
                  <button class="layui-btn" lay-submit lay-filter="form">提交</button>
                  <button type="reset" class="layui-btn layui-btn-primary" id="reset">取消</button>
                  </div>
                  </div>
                  </form>
                  </div>
                  </body>
                  <script type="text/javascript" src="../../../static/js/layui.all.js"
                  charset="utf-8"></script>
                  <script type="text/javascript" src="../../../static/js/jquery-3.2.0.js"
                  charset="utf-8"></script>
                  <script type="text/javascript">
                  /**
                   * 将从数据库中获取到的菜单权限以,分隔开,并默认选中
                   */
                  layui.use('form', function() {
                  var form = layui.form;
                  var functional='#(role.functional)';
                  var groupCheckbox = $("input[name='functional']");
                  for (i = 0; i < groupCheckbox.length; i++) {
                    var val =groupCheckbox[i].value;
                    if(functional.split(',').indexOf(val)!=-1){
                    groupCheckbox[i].checked=true;
                    }
                  }
                  form.render();
                  });
                  </script>
                  </html>
                  layui.use('form', function(){
                   var form = layui.form;
                   //监听提交
                   layui.code
                    form.on('submit(form)', function(data){
                   //获取复选框选中的值
                   var groupCheckbox=$("input[name='functional']");
                   var functional="";
                    for(i=0;i<groupCheckbox.length;i++){
                     if(groupCheckbox[i].checked){
                      var val =groupCheckbox[i].value;
                      if(functional.length>0){
                      functional+=","+val;
                      }else{
                      functional+=val;
                      }
                      
                     }
                    }
                    data.field.functional=functional;
                    
                   $.post("/role/editOk",data.field,function(res){
                   if(res.code=="0"){
                   layer.msg(res.data);
                   }else{
                   layer.msg(res.data);
                   }
                   })
                   return false;
                   });
                  }); 
                  </script>
                  以上这篇是跟版网分享的layui从数据库中获取复选框的值并默认选中方法,希望能给大家一个参考。
                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  tree的api中,只有tree.setChecked(id, idArr)方法,没有取消勾选的方法。我的需求是:勾选后做判断,如果不符合条件则取消勾
                  layui中tab的切换,可使用element.tabChange(filter, layid);用于外部切换到指定的Tab项上,如:element.tabChange(demo, layid); //切换到 lay-id=yyy 的这一项 下例所示 element.tabChange(demo, 22); //切换到:用户管理 具体代码如下: div class="layui-
                  例子: input type="text" id='mobile' name="mobile" value="{$list.mobile}" lay-verify="required|phone|number"; class="form-control" lay-verify:关键字 关键字(支持多条规则的验证)required (必填项)phone(手机号)email(邮箱)url(网址)number
                  layui使用tree组件实现树形下拉菜单,下面是具体代码: html代码: link rel="stylesheet" href="~/layui/css/layui.css" media="all" @*link rel="stylesheet" type="text/css" href="~/layui/font/"*@ style type="text/css" .treeSelect .layui-select-tit
                  layui的tree控件没有搜索功能,在这里我们需要这个功能,要怎么操作呢? 1、html部分代码如下: div class="layui-col-xs2 layui-panel"divinput type="text" id="zf_keyword" placeholder="按关键词搜索"class="layui-input"/divdiv class="layui-tab-item l
                  利用Layui实现可编辑的表格功能,Layui是一套经典而简洁的前端UI框架,具有丰富的组件和强大的功能。在使用Layui开发过程中,我们可能会遇到需要实现可编辑的表格功能的需求。本文将介绍如何利用Layui的table组件和form表单组件,实现可编辑的表格功能,并提

                    <small id='JP4py'></small><noframes id='JP4py'>

                  1. <legend id='JP4py'><style id='JP4py'><dir id='JP4py'><q id='JP4py'></q></dir></style></legend>

                        <tbody id='JP4py'></tbody>

                      <tfoot id='JP4py'></tfoot>
                          <bdo id='JP4py'></bdo><ul id='JP4py'></ul>

                            <i id='JP4py'><tr id='JP4py'><dt id='JP4py'><q id='JP4py'><span id='JP4py'><b id='JP4py'><form id='JP4py'><ins id='JP4py'></ins><ul id='JP4py'></ul><sub id='JP4py'></sub></form><legend id='JP4py'></legend><bdo id='JP4py'><pre id='JP4py'><center id='JP4py'></center></pre></bdo></b><th id='JP4py'></th></span></q></dt></tr></i><div id='JP4py'><tfoot id='JP4py'></tfoot><dl id='JP4py'><fieldset id='JP4py'></fieldset></dl></div>