I have a listing of events. I'd like to remove any events that have duplicate names and dates, but they can have different locations. I can successfully drop duplicates using a variation of code from this thread - JQuery: Remove duplicate elements? However I'd like to hide the location info for the first duplicate item and I can't seem to target that. Here is my code so far...
$('li').each(function() {
var name = $(this).find('.name').text();
var dates = $(this).find('.dates').text();
var nameAndDates = name + dates;
if (seen[nameAndDates]) {
$(this).remove();
}
else {
seen[nameAndDates] = true;
}
});
Somewhere in there I need to target the first duplicate item and add something along the lines of...
$(this).find('.location').hide();
Any ideas?