The method closest()you use is a native JS method and that returns a DOM element object, since it elementrefers to a DOM element object.
There are several options for obtaining the attribute value: either get the datasetproperty:$('.running').each (index, element) =>
console.log element.closest('[data-id]').dataset.id
Or wrap the jQuery element and use the method data().$('.running').each (index, element) =>
console.log $(element.closest('[data-id]')).data('id')
element jQuery jQuery
closest().
$('.running').each (index, element) =>
console.log $(element).closest('[data-id]').data('id')