jquery add remove objects
Posted
by Scarface
on Stack Overflow
See other posts from Stack Overflow
or by Scarface
Published on 2010-05-10T15:15:20Z
Indexed on
2010/05/10
15:24 UTC
Read the original article
Hit count: 132
jQuery
Hey guys quick question, I have an add remove script that will add a unique element and should remove it on a click function but does not. I think it is because the added object is not in the DOM when page is loaded but I am not sure how to fix this. IF anyone has any advice I would greatly appreciate it.
$(document).ready(function(){
if (action=='content-change'){
$('#droppable2-inner').empty().append('<div id="content-image"><img id="visual-background2" src=' + src + '></div><div id="drop-content" action="drop-image">x</div>');
}
$("#drop-content").click(function() {
$('#content-image').remove();
});
})
© Stack Overflow or respective owner