How to get the item that is in drag in a Jquery Drag&drop?

Asked

Viewed 42 times

1

I want to know how to get the item that is in drag and so I can change some properties of it. Follow the example below: inserir a descrição da imagem aqui

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

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 take the event via on and change your clone

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

follows the jsfiddle :)

  • 1

    By the documentation I could find. Still thanks for the answer. : D

Browser other questions tagged

You are not signed in. Login or sign up in order to post.