Javascript: How can I make that if the user check a checkbox then all nested checkbox are selected too?
<p>Let say I have this:</p>

<pre><code>&lt;input id="album" name="album" type="checkbox" value="1" /&gt; 
&lt;label for="album"&gt;Albums&lt;/label&gt;&lt;br&gt; 
&lt;ul&gt; 
    &lt;li&gt; 
        &lt;input id="albums_155596787784467" name="albums[155596787784467]" type="checkbox" value="1" /&gt; 
        &lt;label for="albums_155596787784467"&gt;Profile Pictures&lt;/label&gt;&lt;br&gt;        
    &lt;/li&gt;                   
    &lt;li&gt; 
        &lt;input id="albums_100358313308315" name="albums[100358313308315]" type="checkbox" value="1" /&gt; 
        &lt;label for="albums_100358313308315"&gt;Perfil&lt;/label&gt;&lt;br&gt;      
    &lt;/li&gt;                   
&lt;/ul&gt;
</code></pre>

<p>When the user check the first checkbox I want that all checkboxes in the ul to be checked too.</p>

<p>Also, if any of the checkboxes inside the ul is set to not checked, then the first checkbox should be set to not checked too.</p>

<p>I use JQuery.</p>

<p>Edit:</p>

<p>Also, if all checkboxes inside the <code>ul</code>are checked, then the first checkbox should be checked too.</p>
