Jquery Button Selecting All Checkboxed Within A Div And Button Selecting All On Page
Hi i could really do with some help on this as I cannot get the button to select all checkboxes within .voltSiteResultContainer to work HTML Example:
).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');
});
});
Fixed HTML markup:
<div class="pageContainer">
<inputtype="button"class="check"value="check all" />// want this button to check all on page<divclass="voltSiteResultContainer"><divclass="checkWrap"><inputtype="button"class="checkSite"value="check all" /> // want this button to check all within .voltSiteResultContainer
</div><inputname="checkFile"type="checkbox"class="checkFile"value="1514583" /><inputname="checkFile"type="checkbox"class="checkFile"value="1514583" /><inputname="checkFile"type="checkbox"class="checkFile"value="1514583" /></div>
</div>
<divclass="voltSiteResultContainer"><divclass="checkWrap"><inputtype="button"class="checkSite"value="check all" /> // want this button to check all within .voltSiteResultContainer
</div><inputname="checkFile"type="checkbox"class="checkFile"value="1514583" /><inputname="checkFile"type="checkbox"class="checkFile"value="1514583" /><inputname="checkFile"type="checkbox"class="checkFile"value="1514583" /></div>
Post a Comment for "Jquery Button Selecting All Checkboxed Within A Div And Button Selecting All On Page"