Beginner remove div with jquery

Beginner remove div with jquery

Hello everybody,
I'm using the wonderful Galery from Rudolph Finn. I wanted to extend this galery to a small shopping system, where you can select items on a double click on the image. The Galery needs to be implemented in this form:

<div id="myImageFlow" class="imageflow">
   <img src="picture1.jpg" longdesc="" width="200" height="150" alt="12,00€" id="code1" />
   <img src="picture2.jpg" longdesc="" width="200" height="150" alt="5,00€" id="code4" />
   <img src="picture3.jpg" longdesc="" width="200" height="150" alt="12,00€" id="code5" />
</div>


With jQuery I want to append the following div:
<div class="auswahl">test</div>


This code is able to append the selected items to the div "auswahl", but when I want to remove an item it simply does nothing.
<script type="text/javascript">

      $(document).ready(function(){

      function removeField(id) {

      $(id).remove();

      }

   $("img#code1").dblclick(function(){$("div.auswahl").append("<div id=\"rem1\"><a href=\"#\" onclick=\"removeField(\"rem1\")\"><img src=\"picture1.jpg\" /></a></div>")});

   $("img#code4").dblclick(function(){$("div.auswahl").append("<div id=\"rem4\"><a href=\"#\" onclick=\"removeField(\"rem4\")\"><img src=\"picture2.jpg\" /></a></div>")});

   $("img#code5").dblclick(function(){$("div.auswahl").append("<div id=\"rem5\"><a href=\"#\" onclick=\"removeField(\"rem5\")\"><img src=\"picture3.jpg\" /></a></div>")});

      });

</script>


Where is my mistake? Any help is appreciated since I'm stucked here for 2 days now. I tried many other combinations but without any success.