Vesprawn
Vesprawn

Reputation: 59

Access target object of droppable element

I would like to know if there is a way to access the target object without using selector 'this' for example:

$('.target').on('drop', function(event, ui){
 var drag = ui.helper;
 var target = $(this);
});

I know I can assign the drag with the ui helper but is there a param for the drop target too in this context or is using 'this' the only way to assign the drop target? I couldn't see an option for this int he jQuery API.

Upvotes: 0

Views: 82

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388316

You can use event.target like

$('.target').on('drop', function(event, ui){
 var drag = ui.helper;
 var target = $(event.target);
});

Upvotes: 1

Related Questions