1

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.thanks in advance..i need to get the id of dragged element.

1

3 Answers 3

4

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);
    }
});
Sign up to request clarification or add additional context in comments.

Comments

1

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'));
  },
});

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.