The folliwing fiddle is ok, read below what I need to change at it.
You click on ☑ Subsection 1.1 and then all other get clicked:
- ☑ Subsection 2.1
- ☑ Subsection 2.2
- ☑ Subsection 2.3
- ☑ Subsection 2.4
- ☑ Subsection 3.1
- ☑ Subsection 3.2
- ☑ Subsection 3.3
- ☑ Subsection 3.4
Here is the HTML tree:
Section 1
Subsection 1.1
Subsection 1.2
Subsection 1.3
Subsection 1.4
Section 2
Subsection 2.1
Subsection 2.2
Subsection 2.3
Subsection 2.4
Section 3
Subsection 3.1
Subsection 3.2
Subsection 3.3
Subsection 3.4
More Details:
You can see that the current jsfiddle example works. It works to tick all checkboxes of the current section while ticking one checkbox from inside the current section. I want it to work the same, but not to tick checkboxes of its own section, rather to tick all other checkboxes of the other sections.
Example: I select with "Subsection 1.1" all other sections that are not Section 1. "Subsection 1.1" should select all other: Subsection 2.1, Subsection 2.2, Subsection 2.3, Subsection 2.4, Subsection 3.1, Subsection 3.2, Subsection 3.3, Subsection 3.4
You can handle click on all checkboxes using event delegation mechanism by attaching the handler on the first common ancestor :
You may need to modify this code a bit accordingly to some constraints not yet taken into account.