In JqueryUI sortable, When a user drags an item, the event raised is raised. I got it below.
jsFiddle code here
stop: function(event, ui) { console.log("New position: " + ui.item.index()); }, change: function(event, ui) {
In my code, When the user drags an item (Item7) and changes its position by dragging the item and changing the position. I want to get the position of a drag element.
I just saw the answer here: jQuery UI Sortable Position
In the above link, the position value ( ui.item.index () ) is available in the Stop function , when dragging an element I want its position ( in the change function )? Any ideas?
I need this because when the user tries to place item7 after item2, I will do some checking by getting the values from the previous Item2 (If I know the current position of the drag item, then only I can access the previous item) . If the test was successful, it can be placed or I need to show some message.
source share