Cbfamily

Checkbox group (parent/children) functionality

Download .zip Download .tar.gz View on GitHub

cbFamily

Checkbox group (parent/children) functionality


demo

       

       

Source

<section>
  <h3><label><input type="checkbox" /> Parent 1</label></h3>
  <div class="children">
    <label><input type="checkbox" /> Child 1-1</label> &nbsp; &nbsp;
    <label><input type="checkbox" /> Child 1-2</label> &nbsp; &nbsp;
    <label><input type="checkbox" /> Child 1-3</label>
  </div>
</section>
<section>
  <h3><label><input type="checkbox" /> Parent 2</label></h3>
  <div class="children">
    <label><input type="checkbox" checked="checked" /> Child 2-1</label> &nbsp; &nbsp;
    <label><input type="checkbox" checked="checked" /> Child 2-2</label> &nbsp; &nbsp;
    <label><input type="checkbox" checked="checked" /> Child 2-3</label>
  </div>
</section>

<script type="text/javascript">
  $("h3 input:checkbox").cbFamily(function (){
    return $(this).parents("h3").next().find("input:checkbox");
  });
</script>