function display_item(id, task){
var wrap = document.getElementById('wrap');
var div = document.createElement("div");
div.id = "item"+id;
div.innerHTML = "<a onclick='edit_item(\"" + id + "\")'>" + task + "</a><a href=\"#\" id='itemdel" + id + "'>X</a>";
wrap.appendChild( div );
div = null;
$("#itemdel" + id).click(function (e){
//...
});
}