This code:
$('.grid-stack').on('resizestop', function(e) {
var element = e.target;
console.log(element);
});
outputs:
<div class="grid-stack-item ui-draggable ui-resizable ui-resizable-autohide" data-gs-x="0" data-gs-y="2" data-gs-width="7" data-gs-height="2">
<div class="grid-stack-item-content ui-draggable-handle">
<div class="box-prop top-widget" data-sortable-id="cars-sold-minute" id="cars-sold-minute-block">
<i class="fa fa-times close-x" aria-hidden="true" style="display: none;"></i>
<div class="single-pie">
To the console.log. I am attempting to get the id which is cars-sold-minute-block using jquery but have not been successful. How do I get the id when using the event target?
Edit: I don't want to name the id, as this will be for many different elements.
You can get it by the element class
$('.grid-stack').on('resizestop', function(e) {
var element = e.target;
var id = $(element).find('.box-prop.top-widget').attr('id');
console.log(element);
});