Given that your checkboxes all have an
id
attribute beginning with
"checkbox-"
you can use the CSS "starts with" selector to pick the checkboxes up. In addition you can use the
":checked"
selector. For jQuery the script would look like:
$('input[id^="checkbox-"]:checked');
From there you can map the selected elements based on whatever property you like, and concatenate them into a string.
Here's an example I threw together[
^], you can replace the
prop('id')
bit with whatever you need to be displaying.