How to use the dataset in jQuery?

Good afternoon. I have a question, how can I remove the blocks through a dataset. Below each block was removed separately with a click. I have is slightly different. The first block removes the button, but the second is not. All two blocks are removed.Please tell me

<div class="cart" data-product-id="1">
<span class="remove"><a href="#"><i class="fa fas-ban"></i></a></span>`
<div class="cart" data-product-id="2">
<span class="remove"><a href="#"><i class="fa fas-ban"></i></a></span>

$('.remove').on('click', function (){
March 23rd 20 at 18:58
1 answer
March 23rd 20 at 19:00
Here are a couple of options for how it can be done. As you can see everything easily and clearly.

Find more questions by tags jQuery