title: Jquery toggling multiple block of checkboxes
body: <p>I have this working, but there is a slight issue...</p>
  
  <p>I have 2 blocks of 3 checkboxes. Group A and Group B</p>
  
  <p>If I select 'all' for Group A then all of the checkboxes state in group A is toggled.</p>
  
  <p>If I then select 'all' for Group B I have to click it twice for Group B checkboxes state to change.</p>
  
  <p>This is the JQuery I'm using:</p>
  
  <pre><code>var checked = false;     
  $('.all').click(function () {
      e = $(this).attr('name');
      checked = !checked;
      $('input[class=' + e ).prop('checked', checked);
  });
  </code></pre>
  
  <p>I've created a fiddle example <strong><a href="http://jsfiddle.net/1kgneajL/" rel="nofollow">http://jsfiddle.net/1kgneajL/</a></strong></p>
  
  <p>why do I have to click twice from Group B ?  I plan to add further groups so I need to ensure this isn't going to get worse.  What would happen if I have 10 Groups ?</p>
  
  <p>Any way to resolve this ?</p>
  
  <p>Thanks</p>