jquery 实现checked 选中与不选中 权限配置 thinkphp

来源:互联网 发布:北京凯恩帝数控编程 编辑:程序博客网 时间:2024/06/03 22:42

$(function(){

$("input").click(){

var leval = $(this).attr('level');

if(level==1){

var str='_';

var inputs = $('input['value*='+str+']');

$(this).attr('checked') ? inuts.attr('check',true):inputs.removeAttr('checked');

}else if(level == 2){

var id=$(this).attr('id');

var inputs = $('input[pid='+id+']');

$(this).attr('checked')?inputs.attr('checked',true):inputs.removeAttr('checked');

}else if(level==3){

if($(this).attr('checked')){

var pid = $(this).attr('pid');

$('input[id='+pid+']').attr('checked',true);

var ppid=$('input[id='+pid+']').attr('checked',true);

}

}

}

})

<input id ="2" type ="checkbox" name="access[]" value="2_2" pid="1" level="2" />

<input id ="13" type ="checkbox" name="access[]" value="13_3" pid="2" level="3" />

<input id ="14" type ="checkbox" name="access[]" value="14_3" pid="2" level="3" />


0 0
原创粉丝点击