开发者

how to get dragged event in JQuery UI sortable?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜