If all the checkboxes are inside another element, you can select all the checkboxes inside this element.
Here is an example with one parent element.
<div class="test"><input type="checkbox"><input type="checkbox"></div>
jQuery below also works with multiple divs:
<div class="test"><input type="checkbox"><input type="checkbox"></div> <div class="test"><input type="checkbox"><input type="checkbox"></div>
JQuery
$('.test input:checkbox')
This selects only the checkboxes in any element with the class "test".
-Sunjay03
source share