I'm having a problem with hiding repeated search results.
Here's an example:
Let's say I have a website where I sell cars. I let users search based on a couple of attributes, like brand, model,etc... and then I add all cars to the results. (User can make multiple searches)
I make a search for "Brand A" and I get result:
car-id-1
car-id-2
car-id-3
car-id-4
car-id-5
Now I make a new search for "Brand A" and "Model A", and I get repeated results:
car-id-1
car-id-2
car-id-3
I have my html like this:
<div class='car-id-1'></div>
<div class='car-id-1'></div> /*repeated*/
<div class='car-id-2'></div>
<div class='car-id-2'></div> /*repeated*/
<div class='car-id-3'></div>
<div class='car-id-3'></div> /*repeated*/
<div class='car-id-4'></div>
<div class='car-id-5'></div>
I need some selector so I can hide this repeated cars from my results.
I tried to use :first-of-type but I don't know how to make it all with one rule.
This would probably work:
.car-id-3:not(:first-of-type)
But id's come from database, so this is not a solution, because I can add new cars to db.
Is this even possible?