I wrote this block of code in jquery to create three elements after some events
$('body').append(
tmp= $('<div id="tmp"></div>')
);
$('<div id="close" />').appendTo("#tmp");
$('<div id="box-results" />').appendTo('#tmp');
these three elements are created normally and added to my DOM, but I want to remove them using some function, for example:
$("#close").click(function(e){
e.preventDefault();
$("#tmp").remove();
});
and after I click close, a div notification will occur. what happened to my code?
here is an online example: mymagazine.ir/index.php/main/detail/36 - please find the sentence "here jquery issue" on the site, because the language of the site is Persian
mehdi source
share