I have the following issue. I'm generating multiple data from db and each item has a "delete" btn which has a "data-entryid" attribute with the entry id number.
I want to pass the data attribute of each item when i click the trash icon but with the current js code i only get the first entry's id.
Here's my html btn code where "entry-num" the entry id generated from db:
<a href="#" id="dlt-btn" data-entryid="{entry-num}" class="btn btn-danger delete">
<i class="far fa-trash-alt"></i>
</a>
And here's my js code in which i'm trying (for now) to pass the value in console:
$("#dlt-btn").click(function(){
var entryId = $(this).data("entryid");
console.log(entryId);
});