Сообщение от NMitra
|
вот подниматься проблематично
|
Как вариант...
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<!--
<link rel="stylesheet" type="text/css" href="tmp.css" />
-->
<style type="text/css">
</style>
<script type="text/javascript">
$(document).ready(function (){
$('input:checkbox').click(function (){
var ok=this.checked;
//this.checked=!ok;
$(this).next().find('input:checkbox').each(function (){
this.checked=ok;
});
if (ok) {
$(this).parents('li').children('input:checkbox').each(function (){
this.checked=true;
});
} else {
$(this).parent().parents('li').each(function (){
if ($(this).find('input:checked').length>1) return false;
$(this).children('input:checkbox').get(0).checked=false;
});
};
});
});
</script>
</head>
<body>
<ul class="shest2">
<li>1<input type="checkbox">
</li>
<li>2<input type="checkbox">
<ul class="shest2">
<li>2.1<input type="checkbox">
<ul>
<li>2.1.1<input type="checkbox">
</li>
<li>2.1.2<input type="checkbox">
</li>
</ul>
</li>
<li>2.2<input type="checkbox">
</li>
</ul>
</li>
<li>3<input type="checkbox">
</li>
</ul>
<button>Test</button>
</body>
</html>
Это конечно макет...

Но вроде рабочий.