I have this code that works to hide empty list items
list.find("[name=mobilegridcell_255]:contains(emptylabel)").closest('[name=listPreviousInvoicesItem]').hide();
This hides the last row which contains an unmapped list item. However when I run the same for remove it removes all of the list items
list.find("[name=mobilegridcell_255]:contains(emptylabel)").closest('[name=listPreviousInvoicesItem]').remove();
Can you tell me why?