get data-id jquery code example
Example 1: jquery get data attribute value
<a data-id="123">link</a>
$(this).attr("data-id")
$(this).data("id")
Example 2: jquery get element id
$(this).attr('id')
Example 3: jquery get data-id
const dataId = $('#elementId').attr("data-id");
Example 4: get id by this jquery
alert($(this).attr('id'))
Example 5: javascript get data-id attribute
var element = document.getElementById('myDivID');
var dataID = element.getAttribute('data-id');
var dataID = $('myDivID').data('data-id');
Example 6: data id tag
var dataId = $(this).attr("data-id");