jQuery UI Sortable Position

后端 未结 4 1875
小蘑菇
小蘑菇 2020-12-07 08:03

How do I track what position an element is when its position in a sortable list changes?

4条回答
  •  长情又很酷
    2020-12-07 08:53

    As per the official documentation of the jquery sortable UI: http://api.jqueryui.com/sortable/#method-toArray

    In update event. use:

    var sortedIDs = $( ".selector" ).sortable( "toArray" );
    

    and if you alert or console this var (sortedIDs). You'll get your sequence. Please choose as the "Right Answer" if it is a right one.

提交回复
热议问题