Using jQuery UI sortable with HTML tables

前端 未结 1 1404
借酒劲吻你
借酒劲吻你 2020-12-07 21:37

I want to output some data from the database in a HTML table, and I want the user to be able to reorder table rows. To achieve this, I used jQuery UI sortable, thus:

1条回答
  •  情深已故
    2020-12-07 22:13

    You can call sortable on a instead of on the individual rows.

    1 2
    3 4
    5 6

    $(function() {
      $( "tbody" ).sortable();
    });
     
    table {
        border-spacing: collapse;
        border-spacing: 0;
    }
    td {
        width: 50px;
        height: 25px;
        border: 1px solid black;
    }
     
    
    
    
    
    
    
    1 2
    3 4
    5 6
    7 8
    9 10

    0 讨论(0)
提交回复
热议问题