标签:
1,使用javascript 方法 添加一个隐藏域,然后分割遍历 var strRoles = $("#userRoles").val(); if (strRoles.length>0) { var roleArr = strRoles.split(‘,‘); $.each(roleArr, function(index, roleName){ $("input[type=checkbox][name=‘roles[]‘]").each(function () { if($(this).val() == roleName) { $(this).attr("checked",true); } }); }); }
可以参考一下:http://www.tuicool.com/articles/bMV7j2u
标签:
原文地址:http://my.oschina.net/u/576375/blog/400540