JQuery draggable: access an item being dragged while dragging

I need to change an element as soon as it starts to drag. The "initial" callback takes two arguments, only the first of which, apparently, can be used for me. The fact is that I use helper: 'clone'which forces me to event.originalTargetindicate only the "original" element, and not a new one (which is actually being dragged). Any solutions? Thanks, m.

+3
source share
1 answer

Not ui.helperwhat you need? From the docs:

ui.helper is a jQuery object representing a helper that is being dragged

So you will have something like

$( ".selector" ).draggable({
   start: function(event, ui) {
      ui.helper.modify(the_way_I_want_to_modify_it);
   }
});
+2

Source: https://habr.com/ru/post/1758103/


All Articles