Check all child checkboxes
<p>I need to check all child checkboxes when a user check one parent checkbox. For example, if a user checks the  checkbox with <code>id ='s9'</code> then checkboxes with id <code>s15</code>, <code>s16</code> and <code>s116</code> must be checked, because they have <code>parentId='s9'</code>.</p>

<pre><code>&lt;span class='font-bold'&gt;&lt;input id='s1'  type='checkbox'/&gt;bla&lt;/span&gt;&lt;br/&gt;
&lt;span class='left-indent'&gt;&lt;input id='s2' parentId='s1' type='checkbox'/&gt;bla11&lt;/span&gt;&lt;br/&gt;
&lt;span class='left-indent'&gt;&lt;input id='s3' parentId='s1' type='checkbox'/&gt;bla12&gt;&lt;br/&gt;
&lt;span class='left-indent'&gt;&lt;input id='s4' parentId='s1' type='checkbox'/&gt;bla13&lt;/span&gt;&lt;br/&gt;
&lt;span class='left-indent'&gt;&lt;input id='s5' parentId='s1' type='checkbox'/&gt;bla14&lt;/span&gt;&lt;br/&gt;
&lt;span class='left-indent'&gt;&lt;input id='s6' parentId='s1' type='checkbox'/&gt;bla15&lt;/span&gt;&lt;br/&gt;


&lt;span class='font-bold'&gt;&lt;input id='s8'  type='checkbox'/&gt;bla2&lt;/span&gt;&lt;br/&gt;
&lt;span class='font-bold'&gt;&lt;input id='s9'  type='checkbox'/&gt;bla3&lt;/span&gt;&lt;br/&gt;
&lt;span class='left-indent'&gt;&lt;input id='s15' parentId='s9' type='checkbox'/&gt;bla31&lt;/span&gt;&lt;br/&gt;
&lt;span class='left-indent'&gt;&lt;input id='s16' parentId='s9' type='checkbox'/&gt;bla32&lt;/span&gt;&lt;br/&gt;
&lt;span class='left-indent'&gt;&lt;input id='s116' parentId='s9' type='checkbox'/&gt;bla32&lt;/span&gt;&lt;br/&gt;

&lt;span class='font-bold'&gt;&lt;input id='s10'  type='checkbox'/&gt;bla4&lt;/span&gt;&lt;br/&gt;
&lt;span class='font-bold'&gt;&lt;input id='s11'  type='checkbox'/&gt;bla5&lt;/span&gt;&lt;br/&gt; 
</code></pre>

<p><strong>UPDATE</strong></p>

<p>If some child are checked, parent must be checked too.</p>

<p>If all childs are unchecked, parent must be unchecked too.</p>
