//array used in the example
var userIds = [];
//iterate over object by class
$(".iterate_over_me").each(function(index, item )
{
//do something
});
//iterate over DOM objects using parent object and find method
$("#divOfUsers").find("input[type=checkbox]").each(function ()
{
//check if checkbox is checked
var checked = $(this).is(':checked');
if (checked)
{
//add id to an array
userIds.push($(this).attr("data-id"));
}
});
//iterate over items in the array
$.each(userIds, function(index, value)
{
var currentValue = value;
//or
currentValue = userIds[index];
});