javascript get data-id attribute code example
Example 1: jquery get data-id
const dataId = $('#elementId').attr("data-id");
Example 2: javascript get data-id attribute
//get data-id attribute in plain Javascript
var element = document.getElementById('myDivID');
var dataID = element.getAttribute('data-id');
//get data-id using jQuery
var dataID = $('myDivID').data('data-id');