Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>See simple demo here:</strong> <a href="http://jsfiddle.net/Pfmuq/2/" rel="nofollow">http://jsfiddle.net/Pfmuq/2/</a> <strong>or</strong> simpler: <a href="http://jsfiddle.net/Pfmuq/3/" rel="nofollow">http://jsfiddle.net/Pfmuq/3/</a></p> <p>Please note <code>id</code> should always be unique at all times, rest when you will read the code I have noticed a pattern in your <code>parent</code> and <code>Sub</code> naming hence I took that under account.</p> <p>please note I also took liberty to switch over your id and class anyhoo code is below <code>:)</code></p> <p>Rest hope this helps, <code>:)</code></p> <p><strong>code</strong></p> <pre><code>$('input[name="Company"],input[name="Country"]').click(function(){ if ($(this).is(':checked')){ $(this).nextAll('input[name="'+this.name+'Sub"]').prop('checked',true); } else { $(this).nextAll('input[name="'+this.name+'Sub"]').prop('checked',false); } }); ​ </code></pre> <p><strong>code from 2nd demo</strong></p> <pre><code>$('input[name="Company"],input[name="Country"]').click(function(){ $(this).nextAll('input[name="'+this.name+'Sub"]').prop('checked',this.checked); }); ​ </code></pre> <p><strong>HTML</strong></p> <pre><code>&lt;input type="checkbox" class="entityCheckboxHeader1" id="entityCheckboxHeader" name="Company"&gt;Company &lt;input class="modalEntityCompany" id="entity1" type="checkbox" name="CompanySub"&gt;Microsoft &lt;input class="modalEntity" id="entity2" type="checkbox" name="CompanySub"&gt;Apple &lt;br /&gt; &lt;input type="checkbox" class="entityCheckboxHeader2" id="entityCheckboxHeader" name="Country"&gt;Country &lt;input class="modalEntity" id="entity3" type="checkbox" name="CountrySub"&gt;USA &lt;input class="modalEntity" id="entity4" type="checkbox" name="CountrySub"&gt;UK​​​ </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload