title: jQuery multiple select checkboxes if specific is checked
body: <p>I'm trying to select multiple checkboxes inside a div, if a specific checkbox is selected. Here's what I'm trying to do <a href="http://jsfiddle.net/8PLH6/" rel="nofollow">http://jsfiddle.net/8PLH6/</a> </p>
  
  <p>I'm trying to make this work. If I check "All" all the below checkboxes should be selected. For some reason I can't get the selectors right.
  Code:</p>
  
  <pre><code>&lt;div style="float:left;padding-right:15px;"&gt;
  &lt;div align="left" style="padding-bottom: 4px; padding-left: 6px;" class="bottom"&gt;
      &lt;input type="checkbox" value="1" id="all"/&gt;&lt;a href="#" title="All"&gt;All&lt;/a&gt;
  &lt;/div&gt;
  &lt;div align="left" style="padding-bottom: 4px; padding-left: 6px;" class="bottom"&gt;
      &lt;input type="checkbox" value="1" id="cat417"/&gt;&lt;a href="" title="1"&gt;1&lt;/a&gt;
  &lt;/div&gt;
  &lt;div align="left" style="padding-bottom: 4px; padding-left: 6px;" class="bottom"&gt;
      &lt;input type="checkbox" value="1" id="cat410"/&gt;&lt;a href="" title="2"&gt;2&lt;/a&gt;
  &lt;/div&gt;
  &lt;div align="left" style="padding-bottom: 4px; padding-left: 6px;" class="bottom"&gt;
      &lt;input type="checkbox" value="1" id="cat401"/&gt;&lt;a href="" title="3"&gt;3&lt;/a&gt;
  &lt;/div&gt;
  &lt;div align="left" style="padding-bottom: 4px; padding-left: 6px;" class="bottom"&gt;
      &lt;input type="checkbox" value="1" id="cat415"/&gt;&lt;a href="" title="4"&gt;4&lt;/a&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and </p>
  
  <pre><code>$(document).ready(function () {
  $('#all').change(function () {
      $a = $(this).parent('div').parent('div').children('div').children('input[type="checkbox"]');
      $b = $(this).attr('checked');
      if ($b) {
          $($a).attr('checked', true);
      } else {
          $($a).attr('checked', false);
      }
  });
  </code></pre>
  
  <p>});</p>