if you are using jQuery:
var checkboxList = [];
// Loops each fieldset
$("fieldset.step").each(function() {
var stepIndex = $(this).index();
// Loops each checkbox that is checked inside of the fieldset
$(this).find("input:checked").each(function() {
// Adds the id to the list
checkboxList.push({
step: stepIndex,
checkboxId: $(this).attr("id")
});
});
});