HTML代码:
<table class="table table-bordered table-striped with-check"> <thead> <tr> <th></th> <th >一级权限</th> <th ></th> </tr> </thead> <tbody> <tr > <td style="text-align:center"></td> <td style="text-align:center"><label><input type="checkbox" class="authcheck"></label></td> <td ><input type="checkbox" class="authcheck1">{$vv.auth_name}</td> </tr> </tbody> </table>jQuery代码:$('.authcheck').click(function(){ if ($(this).is(":checked")) { $(this).parent().parent().next().children('input').attr("checked",true) }else{ $(this).parent().parent().next().children('input').attr("checked", false) } }) var i=0; $('.authcheck1').click(function(){ //alert( $(this).parent().children('input').CSS('background','red')); $(this).parent().children('input').each(function (index, domEle) { if($(this).attr("checked")!='checked'){ i=1; } }); if(i==0){ $(this).parent().PRev().children().children('input').attr("checked", true) }else{ $(this).parent().prev().children().children('input').attr("checked", false) } i=0; })
新闻热点
疑难解答