Can someone tell me what's wrong with this function, because as far as i can tell, it should work. It created the alert, but the bind part does not work. At all. Wtf?

CODE
function addalert(msg){
  var count = $("#ac > div").length;
  console.log(count);
  $("#ac").append("<div id=\"alert["+count+"]\" class = \"alert\">Alert: "+msg+"<d id=\"cloze["+count+"]\"><img src=\"red-x-icon.gif\" width=\"25\" height=\"25\" align\"absmiddle\" /></d>");
  console.log("<div id=\"alert["+count+"]\" class = \"alert\">Alert: "+msg+"<d id=\"cloze["+count+"]\"><img src=\"red-x-icon.gif\" width=\"25\" height=\"25\" align\"absmiddle\" /></d>");
  console.log("#cloze["+count+"]");
  $("#cloze["+count+"]").click(function(){    
        console.log("niggers!");
        $("#alert["+count+"]").slideUp(1000);
  });
}


I just trial and error'd it for like half an hour, there really isn't much i can change about those 4 lines of code. I debugged it thoroughly, just to make sure, and everything is working exactly as expected, its just not working!