Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery button selecting all checkboxed within a div and button selecting all on page
    primarykey
    data
    text
    <p>Hi i could really do with some help on this as I cannot get the button to select all checkboxes within .voltSiteResultContainer to work </p> <p><strong>HTML Example:</strong></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 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> <p></p> <p><strong>Current Jquery:</strong></p> <pre><code> &lt;script type="text/javascript"&gt; $(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'); }) }) $(document).ready(function(){ $('.checkSite:button').toggle(function(){ .closest('.voltSiteResultContainer').find('input:checkbox').attr('checked','checked'); $(this).val('uncheck all') },function(){ $('input:checkbox').removeAttr('checked'); $(this).val('check all'); }) }) </code></pre> <p></p> <p>So $('.check:button') work but $('.checkSite:button') is not :(.</p> <p>Thank you in advance for any help you can give me :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
 

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