Question

I'm dragging elements from one unordered list to another:

$('ul#drag li').draggable({ helper: 'clone' });
$('ul#drop').droppable({
    drop: function (event, ui) {
        ui.draggable.sourceElement.css(... ...);
    }
});

I want to mark already dragged elements in source list (but still allow dragging them), how do I access them through jQuery chain?

I guess I can set id attribute on the dragged element, and when dropping, the cloned element would have the same id, which I can use in finding the original, but I'm sure there's a nicer solution.


Was it helpful?

Solution

I wonder why I did not notice that the following works, the first time I tried it:

ui.draggable.css('whatever');

It's even documented:

ui.draggable - current draggable element, a jQuery object.

OTHER TIPS

e.target refers to the original element

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top