prepend doesnt work

prepend doesnt work

Hi everybody,

I am using $.post to add new group name to DB and show newly created group to the user. Here is the code:

  1.  $('#new_group').click(function(){
  2.         var name = $("#group_name").val();

  3.         $.post("/async/addgroup",{
  4.             "name" : name
  5.         }, function(response){
  6.             var id = response;
  7.             var echo_str = $("<div id='group_"+id+"'><strong>Name:</strong> <div class='editgroup' id='"+id+"'>"+name+"</div><a href='#' class='clickeditgroup'>Edit</a> | <a href='#' id='"+id+"' class='deletegroup'>Delete</a></div>");
  8.             $("#group_names").prepend(echo_str.hide().fadeIn());
  9.             $("#group_name").val("");
  10.         });
  11.         
  12.         return false;
  13.     });

this work well, but when the new div is created (fadedIn) I am not able to click the edit and delete button. I have to refresh the page to make them work.

Here is the code for deleting group
  1. $('.deletegroup').bind('click',function(){
  2.         var id = $(this).attr('id');
  3.         
  4.         $('#group_'+id).fadeOut(1000,function(){
  5.             $('#group_'+id).remove();
  6.         });
  7.         return false;
  8.     });
I have compared the HTML code before and after reloading page and it is the same.
I am really confused. Any Ideas?

Any help would be much appreciated.
P.