layui checkbox回显问题

<div class="layui-col-md4">
     <label class="layui-form-label">唯一项</label>
      <div class="layui-input-block">
        <input type="checkbox" id="wyxChickBox" lay-filter="wyx"   class="checkClass"  lay-skin="primary" >
            <input type="hidden" id="wyx" name="wyx" value="0">
               </div>
</div>
var item = $(".checkClass"); //试了好多种取值的方法都取不到值,最后发现可以通过class获取元素 
item.each(function ()
{ if($(this)['context'].id=="
wyxChickBox"){
    if (zddy_json['wyx']=="1")//回显checkbox   zddy_json是带有值得json数组
{ $(this).prop("checked", true);
    $("#wyx").val(1);
    }
  }
}

form.render();//别忘了刷新
原文地址:https://www.cnblogs.com/jcx7/p/12741064.html