Html:
<!DOCTYPE HTML><HTML><Head> <title>Node List</title> <Linkrel= "stylesheet"type= "Text/css"href= "__public__/css/public.css"> <Linkrel= "stylesheet"type= "Text/css"href= "__public__/css/node.css"> <Scripttype= "Text/javascript"src= "__public__/js/jquery.js"></Script> <Scripttype= "Text/javascript"src= "__public__/js/node.js"></Script></Head><Body> <DivID= "Wrap"> <Div> <ahref= "<{:u ('/admin/rbac/role ')}>"class= "Add-app">Return</a> </Div> <Div> <foreachname= "Node"Item= "App"> <Divclass= "App"> <P> <Strong><{$app. Title}></Strong> <inputtype= "checkbox"name= "access[]"value= "<{$app. Id}>_1" Level= ' 1 '/> </P> <foreachname= "App.child"Item= "Action"> <DL> <DT> <Strong><{$action. Title}></Strong> <inputtype= "checkbox"name= "access[]"value= "<{$action. Id}>_3" Level= ' 2 '/> </DT> <foreachname= "Action.child"Item= "Func"> <DD> <span><{$func. Title}></span> <inputtype= "checkbox"name= "access[]"value= "<{$func. Id}>_3" Level= ' 3 '/> </DD> </foreach> </DL> </foreach> </Div> </foreach> </Div> </Div></Body></HTML>
Js:
$ (document). Ready (function () { $ (' input[level= ' 1 "] '). The Click (function () { var inputs = $ (this). Parents ('. App ') ). Find (' input '); $ (this). Prop (' checked ')? Inputs.prop (' checked ', true): inputs.removeattr (' checked ', false); }); $ (' input[level= ' 2 "]). Click (function () { var inputs = $ (this). Parents (' DL '). Find (' input '); $ (this). Prop (' checked ')? Inputs.prop (' checked ', true): inputs.removeattr (' checked ', false); });
Jquery-checked Select All and deselect all