The row is deleted but as clicking makes you follow the link, it's immediately restored when the page is refreshed.
Add return false;
or event.preventDefault(); at the end of the callback to prevent the default behavior :
$(document).ready(function() {
$("#favoriteFoodTable .deleteLink").on("click",function() {
var tr = $(this).closest('tr');
tr.css("background-color","#FF3700");
tr.fadeOut(400, function(){
tr.remove();
});
return false;
});
});
Demonstration
Note that I used closest
for a more reliable code : if another element comes in between, the tr
will still be found.