I want append link add in last child of class:(('.' + change_class + ':last .adda .mediumCell:first')) after remove, but if you remove last chil (44444444444444444444), it not append in last child mean 3333333333333333333 and remove with same row, how can fix it?
Example from my code: http://jsfiddle.net/LX49c/1/
$('.remove').live('click',function (e) {
e.preventDefault();
var change_class = $(this).closest('.find_input').find('div').attr('class').split(" ")[0];
var url = $(this).closest('.find_input').find('div').attr('class').split(" ")[1];
var get_class = $(this).closest('.' + change_class).attr('id');
$('#' + get_class).fadeOut('slow', function () {
$(this).remove();
});
$('.' + change_class + ':last .adda .mediumCell:first').append('<a href="" class="add_input">add</a>');
});
Move the
append(...)to within the.fadeOutfunction. See http://jsfiddle.net/LX49c/2/An alternative method is to remove the class before appending: http://jsfiddle.net/LX49c/4/
You’re doing multiple expensive JQuery calls. I’d suggest replacing the following code: