1. 程式人生 > 其它 >layui 動態設定checkbox預設值

layui 動態設定checkbox預設值

html:

js: setDefaultChecked: function () { var rows = table.checkStatus("tab_container").data; var loadIndex; $.ajax({ type: "POST", url: 'FindYarnInList',//後端查詢,返回ture 或者fasle data: { innerNo: rows[0].InnerNo}, dataType: "json", beforeSend: function () { loadIndex = showLoading() }, success: function (data) { if (data.Success) { ** $("#IsBrandType").removeAttr('checked');** ** layui.form.render(); ** } else { $("#IsYarnLogic").removeAttr('checked'); layui.form.render(); } }, }); },