how to delete element created with jquery ?!
- by mehdi
hi ,
i have write this block of code in jquery to create three element after some events
$('body').append(
tmp= $('<div id="tmp"></div>')
);
$('<div id="close" />').appendTo("#tmp");
$('<div id="box-results" />').appendTo('#tmp');
this three elements are created normally and added to my DOM but i want to remove them with some function like this :
$("#close").click(function(e){
e.preventDefault();
$("#tmp").remove();
//$("#overlay").remove();
});
and after i click close div noting happen ! what's wrong with my code ?