jQuery Sortable - How to get current dragged element attribute

Try $(ui.item).data('attribute_name'); or $(event.currentTarget).data('attribute_name');


I'm using at UPDATE event:

 update: function (event, ui) {

          var attr_id = ui.item.attr('data-id');
        }

Using $(this) will give you the element on which the sortable is initialized. Refer the Sortable Documentation . The current sortable item is stored in ui object and you can access it using ui.item .

So you can access any attribute of current sortable item by applying functions or methods on ui.item . Prefer using $(ui.item) .

Demo : http://jsfiddle.net/lotusgodkk/GCu2D/173/

$(document).ready(function () {
    $(".draggable-item").sortable({
        start: function (event, ui) {
            var attr = $(ui.item).attr('data-parent');
        },
    }).disableSelection();
});