Search code examples
jquery-uidroppablejquery-ui-droppablejquery-droppable

jquery droppable - nested divs, get target id


I have something like this:

$('#mover' ).draggable({});
$('div').droppable({
    drop: function(event, ui) {
        console.log(event.target.id)
    }

then

<div id="container">
    <div id="target_1"></div>
    <div id="target_2"></div>
    <div id="target_3"></div>
</div>

When I drop mover on a div "container" is returned. how do I return instead the lowest child that the item was dropped on?


Solution

  • I know the solution to the actual problem: I was trying to drop an element on same div that it came from.