clone upon page load

clone upon page load

Hi,

I have this:

  1. $('input:checkbox:checked').each(function() {
                            $(this).parent().css('background-color', 'red');
    $(this).parent().clone().appendTo('#selected_items');
    });

or this:

  1.     $('input:checkbox:checked').parent().css('background-color', 'red').clone().appendTo('#selected_items');

In both cases the css works and the cloning doesn't.

I also have this working just fine:
  1.     $('#test_kit .two_thirds .kit_item input:checkbox').click(function() {
  2. if ($(this).is(':checked')) {
  3. $(this).parent().clone().appendTo('#selected_items');
  4. } else {
  5. var item_id = $(this).parent().attr('id');
  6. $('#selected_items .kit_item[id='+item_id+']').hide('fast', function(){ $(this).remove(); } );
  7. }
  8.     });

When clone() is triggered by a click it works.

I can't figure out how I could get a set of elements cloned upon page load.

Any help appreciated!
L.