You are viewing limited content. For full access, please sign in.

Question

Question

Adding Check All in Collection

asked on April 30, 2019

I have check box in my collection. What is the best way to add Check All, so that it checks/unchecks all the checkboxes in the collection please? Thanks.

 

Priya

0 0

Answer

APPROVED ANSWER
replied on May 2, 2019

You could do this by applying a CSS class to all your checkboxes inside the collection like "myCheckboxes". Then, create two buttons via custom HTML like this:

<button id="CheckAllButton" type="button" style="float:left;">Check All</button> <button style="float:right;" type="button" id="ClearAllButton">Clear All</button>

JavaScript for the buttons:

$(document).ready(function(){ 
$('#CheckAllButton').on("click", function(){
$('.myCheckboxes input').prop('checked', true).change();
});
$('#ClearAllButton').on("click", function(){
$('.myCheckboxes input').prop('checked', false).change();
});
});

Hope that helps!

0 0

Replies

replied on May 1, 2019

Any help please? Thanks.

 

Priya

0 0
replied on May 2, 2019

Thanks

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.