layui radio 根据获取的到值选中

<input type="radio" name="lwkg" value="1" title="开" lay-filter="lwkg">
<input type="radio" name="lwkg" value="0" title="关" lay-filter="lwkg">

 

layui.use(['form', 'layedit', 'laydate'], function () {
var $ = layui.jquery, form = layui.form;

$.ajax({
type: "POST",
url: "../Method/GetParamter.ashx?rnd=" + Math.random(),
dataType: "text",
success: function (data) {
var s = eval(data);
if (s.length > 0) {
var o = s[0];

var lwjs_PD = o.lwjs_PD;
$("input[name=lwkg][value=1]").attr("checked", lwjs_PD == 1 ? true : false);
$("input[name=lwkg][value=0]").attr("checked", lwjs_PD == 0 ? true : false);

 

form.render(); //更新全部


}
}
});


});

posted @ 2019-01-03 15:28  橘子拾光  阅读(5475)  评论(0编辑  收藏  举报