List checked items in a resultset

List checked items in a resultset

I want to list out all the items that are checked in a resultset. I current have this to display the checked items.   

$(function() {
    $('input[type="checkbox"]').bind('click',function() {
        if($(this).is(':checked')) {
            $('#mydiv').append(' '+$(this).val());
         }
   });



How can i modify the code to remove the items from the list when it is unchecked?

Thanks