jQuery UI sortable: determining in what order the items are

后端 未结 5 927
深忆病人
深忆病人 2020-12-13 20:22

Here is an interesting use of JavaScript: reordering items with drag and drop. The implementation itself in my page works fine, but is there a way to determine in which orde

5条回答
  •  清歌不尽
    2020-12-13 20:52

    I have used following code to get the order of item.

    Html

         
    1
    2
    3
    4
    5
    6

    JQuery

         $(document).ready(function(){
            $("#sortable").sortable({
                stop : function(event, ui){
            $('#sortable > div').each(function(){
               alert($(this).html());
           });          
            }
        });
      $("#sortable").disableSelection();
    });
    

提交回复
热议问题