首页 > 学院 > 开发设计 > 正文

Jquery单击选择权限实例

2019-11-08 02:10:27
字体:
来源:转载
供稿:网友

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;        })


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表