私は次のようなフォームを持っています:-
<form name="frmChkForm" id="frmChkForm">
<input type="checkbox" name="modules[1]" onclick="checkgroup(this)" value="1">Module 1<br>
<input type="checkbox" name="units[1][1]">Unit 1
<input type="checkbox" name="units[1][2]">Unit 2
<input type="checkbox" name="units[1][3]">Unit 3<br>
<input type="checkbox" name="modules[2]" onclick="checkgroup(this)" value="2">Module 2<br>
<input type="checkbox" name="units[2][1]">Unit 4
<input type="checkbox" name="units[2][2]">Unit 5
<input type="checkbox" name="units[2][3]">Unit 6<br>
<input type="checkbox" name="modules[3]" onclick="checkgroup(this)" value="3">Module 3<br>
<input type="checkbox" name="units[3][1]">Unit 7
<input type="checkbox" name="units[3][2]">Unit 8
<input type="checkbox" name="units[3][3]">Unit 9
</form>
各モジュール(メインチェックボックス)の下にあるすべてのサブチェックボックスをオン/オフにします。
たとえば、「モジュール1」をチェックした場合は、ユニット1、2、3のみをチェックし、「モジュール1」のチェックを外すと、これらのユニットのチェックを外す必要があります。他のモジュールでも同じように動作するはずです。
これを実行するJavascript関数を探しています。