Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2><em><a href="http://jsbin.com/ojihos/1/edit" rel="nofollow">jsBin demo</a></em></h2> <p>Add <code>$(this)</code> in line 11 - and a missing <code>&lt;/div&gt;</code> in your HTML:</p> <pre><code> $(document).ready(function(){ $('.check:button').toggle(function(){ $('input:checkbox').attr('checked','checked'); $(this).val('uncheck all'); },function(){ $('input:checkbox').removeAttr('checked'); $(this).val('check all'); }); $('.checkSite:button').toggle(function(){ $(this).closest('.voltSiteResultContainer').find('input:checkbox').attr('checked','checked'); // HERE!! $(this).val('uncheck all'); },function(){ $(this).closest('.voltSiteResultContainer').find('input:checkbox').removeAttr('checked'); $(this).val('check all'); }); }); </code></pre> <p>Fixed HTML markup:</p> <pre><code>&lt;div class="pageContainer"&gt; &lt;input type="button" class="check" value="check all" /&gt; // want this button to check all on page &lt;div class="voltSiteResultContainer"&gt; &lt;div class="checkWrap"&gt; &lt;input type="button" class="checkSite" value="check all" /&gt; // want this button to check all within .voltSiteResultContainer &lt;/div&gt; &lt;input name="checkFile" type="checkbox" class="checkFile" value="1514583" /&gt; &lt;input name="checkFile" type="checkbox" class="checkFile" value="1514583" /&gt; &lt;input name="checkFile" type="checkbox" class="checkFile" value="1514583" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="voltSiteResultContainer"&gt; &lt;div class="checkWrap"&gt; &lt;input type="button" class="checkSite" value="check all" /&gt; // want this button to check all within .voltSiteResultContainer &lt;/div&gt; &lt;input name="checkFile" type="checkbox" class="checkFile" value="1514583" /&gt; &lt;input name="checkFile" type="checkbox" class="checkFile" value="1514583" /&gt; &lt;input name="checkFile" type="checkbox" class="checkFile" value="1514583" /&gt; &lt;/div&gt; </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. 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