How do I get the item that is on the drag in a JQuery Drag & Drop?

1

I want to know how to get the item that is in drag and so I can change some properties of it. Here's the example below:

According to the example above I need to change the item I'm dragging and not its original.

    
asked by anonymous 28.08.2015 / 23:21

1 answer

1

You can do this in two ways:

$('#seletor').draggable({
    drag: function (event, ui) {
        //só acessar o ui.helper
        $(ui.helper).css('color', 'red');
    }
});

Or you can also grab the event via on and change your clone

$('#seletor').on('drag', function( event, ui ) {
        //só acessar o ui.helper
        $(ui.helper).css('color', 'red');
});

follow the jsfiddle :)

    
28.08.2015 / 23:40