arborescence checked or not
Bonjour, voila j'ai un ptit soucis
tjrs avec mon arborescence !
Code:
1 2 3 4 5 6 7
|
<ul class="checklist">
<li><input id="child[1]" name="subject[]" onclick="uncheckParent(0)" value="1" type="checkbox"><label for="child[1]">TEST</label>
<ul><li><input id="child[6]" name="subject[]" onclick="uncheckParent(1)" value="6" type="checkbox"><label for="child[6]">tes</label>
</li></ul></li><li><input id="child[19]" name="subject[]" onclick="uncheckParent(0)" value="19" type="checkbox"><label for="child[19]">alex</label>
</li><li><input id="child[10]" name="subject[]" onclick="uncheckParent(0)" value="10" type="checkbox"><label for="child[10]">alexandre gasté</label>
</li><li><input id="child[9]" name="subject[]" onclick="uncheckParent(0)" value="9" type="checkbox"><label for="child[9]">alexandre</label> |
avec cette fonction , ci dessous en javascript ca décoche le parent lorsqu'on click sur un child .. ce que jaimerai c'est l'inverse , que ca décoche tout les childs lorsque je click sur un parent
Code:
1 2 3 4 5 6
|
function uncheckParent(parent_id)
{
if(parent_id!=0 && document.getElementById('child['+parent_id+']') && document.getElementById('child['+parent_id+']').checked == true)
document.getElementById('child['+parent_id+']').checked = false;
} |