开发者

how to get dragged event in JQuery UI sortable?

开发者 https://www.devze.com 2022-12-27 03:54 出处:网络
i am using this jquery to make a drag and drop sortable list. http://jqueryui.com/demos/sortable/ how i can catch the dragged event of elements ?

i am using this jquery to make a drag and drop sortable list. http://jqueryui.com/demos/sortable/ how i can catch the dragged event of elements ?

<script>

$(document).ready(function() { $("#sortable").sortable(); });

</script>

please help me.am not familiar with jquery.tha开发者_高级运维nks in advance..i need to get the id of dragged element.


Here's how to get the ID of the dragged element:

$('#sortable').sortable({
    stop: function(ui, event){
        var id = event.item.attr('id');
        alert(id);
    }
});


Very similar to previous answer but I used deactivate to capture the event after a sorting has been done

jQuery:

$('.week').sortable({
  deactivate: function (ui,e) {
    console.log(e.item.attr('id'));
  },
});


According to this page, you might use start or activate events.

0

精彩评论

暂无评论...
验证码 换一张
取 消