You need to do the deletion AFTER the animation is complete. This can be added to the animate() call as a full parameter (a function that will be called when the animation finishes):
$(this).animate({ "opacity" : "0", //property 1000, //duration of animation (optional) function(){$('#mydata').remove();} //function to run on complete (optional) });
Learn more in the jQuery API.
source share