Finding out draggable target

Finding out draggable target


Hi,
I am trying to achieve something which should be pretty straight
forward with the draggable widget but I can't find a way:
I want a draggable element to revert (go back to its initial position)
if it's not dropped on an element with a specific class. It seems I
can't add the revert option on the stop action (woud set the option
for the next drag action), so I am trying to set it while dragged:
$("#draggable li").bind('drag',function(e,ui){
    if ( $(e.target).hasClass("targets") ){
        $(this).draggable('option', 'revert', false);
    }
    else{
        $(this).draggable('option', 'revert', true);
    }
});
The problem is that my class target is always the class of the
draggable element, instead of the element below it.
Can someone help?
Many thanks,
Thomas