Hi, I am using the JQuery libs to implement drag and drop.
How do I get at the element that is being dragged when it is dropped into sortable list?
I want to get the id of the div being dragged. The following element is dragged:
<div class="control" id="control[1]" >
<img src="img/controls/textfield.png" />
</div>
I have the standard dragging function from their example
$(".control").draggable({
connectToSortable: '#sortable',
helper: 'clone'
});
function stop in dragging section with next code return proper value
stop: function(event, ui) {
alert(ui.helper.attr('id'));
}
And this is sortable element:
<ul id="sortable"><li>test</li></ul>
and his function:
$("#sortable").sortable({
revert: true,
accept: '.control',
receive: function(event, ui) {
// here i need to get draggable element id
}
});
I have tried various ui.id etc which doesnt seem to work.
receive: function(event, ui) {
$(ui.draggable).attr("id")
}
throws undefined.
Thanks,