I have an disappearing delete animation code and I want to get the entire div "parent_parent" to disappear.
Here is the HTML
<div class="parent_parent">
<div class="parent">
<a href="?delete=1" class="delete_link"></a>
</div>
</div>
And here is part of the jquery code that makes the parent_parent div disappear:
$(document).ready(function() {
$('a.delete_element').click(function(e) {
e.preventDefault();
var parent = $(this).parent();
$.ajax({
type: 'get',
url: 'delete.php',
data: 'ajax=1&delete=' + parent.parent().attr('id').replace('sort_', ''),
beforeSend: function() {
parent.parent().animate({
'backgroundColor': '#fff'
}, 300);
},
success: function() {
parent.parent().slideUp(300,function() {
parent.parent().remove();
});
}
});
});
});
But so far no animation happens, but if I just call one parent then the inside div does disappear. I don't get any error messages either.
.between the lastparent()andslideUp.parentisn't defined. You need$(this), and then a reference to what you want.divits own ID. That way, you don't need to mess withparent()and classes.