How can I determine which dynamically-created checkboxes were checked by the user?

How can I determine which dynamically-created checkboxes were checked by the user?


So I'm able to create whatever group of checkboxes I want by using code such as: 

HTML
  1. <div id="container1" class="checkboxGroups2Col"></div>
    <div id="container2" class="checkboxGroups3Col"></div>
    <div id="container3" class="checkboxGroups4Col"></div>
CSS
  1. .checkboxGroups2Col { width: 400px; margin-bottom: 10px; border: 1px solid orange; }
    .checkboxGroups3Col { width: 600px; margin-bottom: 10px; border: 1px solid orange; }
    .checkboxGroups4Col { width: 800px; margin-bottom: 10px; border: 1px solid orange; }
jQuery
  1. $('#container1').appendCheckboxes('foo',['Apple','Banana','Cranberry','Dill']);
    $('#container2').appendCheckboxes('bar',{
        'Almond':1,'Blueberry':2,
        'Cherry':3,'Dumpling':4
    });
    $('#container3').appendCheckboxes('critters',['Armadillo','Baboon','Cheetah','Duckbilled Platypus', 'Eagle', 'Fox', 'Goose', 'Hyena', 'Iguana', 'Jaguar', 'Komodo Dragon', 'Leopard', 'Mountain Lion', 'Northern Flicker', 'Opossum', 'Porpoise', 'Quail', 'Ring-tailed Monkey', 'Sabre-toothed and/or Siberian Tiger', 'Tasmanian Devil', 'Unicorn', 'Vole', 'Woozel (commonly seen with Heffalumps)', 'X-Ray Fish', 'Yellow-bellied Sapsucker', 'Zebra']);


Now I need to be able to determine which checkboxes the user has selected. I am floundering along with this pseudocode which may or may not be "on the right track":

  1. $('#btn1').click(function() {
                $('container1').find('checkbox').Attr('checked')...???
            });

I need to be able to store the selected checkbox vals in an array; storing their text vals will be fine. IOW, if the contents of the array were ['Duckbilled Platypus', 'Northern Flicker', 'Porpoise', 'Quail'] that would be fine.

I reckon I should probably set up a click event for the checkboxes, and then in response, add or remove them from the list/array of selected items, but I'm not sure how to do that, either (IOW, I don't know).