I'm coding a task panel with three lists and I use sortable to move item between them. But I need to pick up the item where the element is dropped. I know that ui.item
is the element dropped, but I don't know where I dropped it. Here is my code:
$( ".column" ).sortable({
receive: function(event, ui) {
/* get the element where ui.item is dropped */
}
});
I know that the element will be any with the .column
selector, but how to pick!!!
EDIT - a way to do that is like this
$("#sortable1, #sortable2").sortable({
connectWith: ".connectedSortable",
receive: function(e, ui) {
alert(ui.item.closest('ul').attr('id'));
}
}).disableSelection();
Of course if you wan't to get the element next to the dropped element you'd do
ui.item.closest('ul')
fiddle here http://jsfiddle.net/dKaYM/
Very Simple:
alert($(this).attr('id')); //this is element where the item was dropped in
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With