$(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" />
jquery 实现checked 选中与不选中 权限配置 thinkphp

最新推荐文章于 2022-06-16 21:07:30 发布