Remove a DIV using a link
Posted
by
GSTAR
on Stack Overflow
See other posts from Stack Overflow
or by GSTAR
Published on 2011-01-05T16:31:30Z
Indexed on
2011/01/05
16:53 UTC
Read the original article
Hit count: 157
jQuery
HTML:
<div class="row">
<!-- content -->
<a href="#" class="remove">remove</a>
</div>
JS:
$('.remove').click(function(){
$(this).parent().remove();
return false;
});
If there is only one DIV it works OK but when there are multiple DIVS (class="row"
) it won't do anything. No errors are returned either.
EDIT: I should add that by default there is only one div - additional divs get dynamically created using a jQuery clone function - perhaps this is why it won't recognise the new link/div?
© Stack Overflow or respective owner