0

i have to do in such a way that when i drag a list from ul id[sortable1] and drop on li of ul id[sortable2] both can change their place I mean if i can drag a list from sortable 1 and drop to sortable 2 then sortable 2 list can placed in sortable 1 and sortable 1 list can placed in sortable 2

For ex. if i can drag item1 and drop to item6 then item6 can place on item1 and item1 on item 6

    <head>
      <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
      <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

      <script>
        $(function() {
          $( "#sortable1, #sortable2" ).sortable({
            connectWith: ".connectedSortable"
          }).disableSelection();
        });
      </script>
    </head>
    <body>
      <ul id="sortable1" class="connectedSortable">
        <li>Item 1</li>
        <li>Item 2</li>
        <li>Item 3</li>
        <li>Item 4</li>
        <li>Item 5</li>
      </ul>
      <ul id="sortable2" class="connectedSortable">
        <li>Item 6</li>
        <li>Item 7</li>
        <li>Item 8</li>
        <li>Item 9</li>
        <li>Item 10</li>
      </ul>
     </body>
    </html>
Prashobh
  • 9,216
  • 15
  • 61
  • 91
user3292597
  • 27
  • 2
  • 8
  • problem is that you not drop item on item, you drop item to list, so you need somehow to know what items should be swaped... so i guess you better go with draggable and detect where item was dropped... and swap them – Nikita Holovach Feb 14 '14 at 14:39
  • Here is what im talked about http://stackoverflow.com/a/18580488/893828 – Nikita Holovach Feb 14 '14 at 14:49

0 Answers0