Randomblue
Randomblue

Reputation: 116273

Accessing helper clone of draggable element

I am applying .draggable() with helper: clone to an element. I also have droppable elements. Events triggered by any of the droppable elements fire a callback with signature

function (event, ui)

Within this function, $(this) refers to the droppable element, and ui.draggable to the draggable element (not the helper clone).

How can I access the helper clone from within the callback function?

Upvotes: 1

Views: 1681

Answers (2)

Randomblue
Randomblue

Reputation: 116273

ui.helper does the job. Shame it's not well documented. Had to inspect the source.

Upvotes: 4

ShankarSangoli
ShankarSangoli

Reputation: 69905

You can try this in the callback method.

var helper = $( ".selector" ).draggable( "option", "helper" );

Where .selector is the element on which you have applied the draggable plugin.

Upvotes: 1

Related Questions