UI sortable - when item is dragged from list B to list A the last item in A is sent to B ?

UI sortable - when item is dragged from list B to list A the last item in A is sent to B ?

Hi

I've been searching through this forum and various others for a solution or an example but I haven't found anything so here goes ...

I've got my two lists and they're connected in the standard way, and that works fine - the items from list B are added into list A

But when list A already contains 6 elements I need to be able to remove the last list item in A and append it to the top of B

So, when I count the children items of list A and, if count>=6, how would I get the last one and remove it ?
Also, would I just be able to use the id "# sortable2" of list B to append the item from list A ?

thanks for any help you can give

basically my code is this :
  1. <script>
  2.   $(function() {
  3.     $( "#sortable1, #sortable2" ).sortable({
  4.       connectWith: ".connectedSortable"
  5.     }).disableSelection();
  6.   });
  7. </script>


  8. <h3>List A</h3>

  9. <ol id="sortable1" class="connectedSortable" style="list-style-type:decimal;">
  10. <li  class="ui-state-default">Default first item</li>
  11. </ol>

  12. <h3>List B</h3>

  13. <ul id="sortable2" class="connectedSortable">
  14. <li class="ui-state-highlight">Item 1</li>
  15. <li class="ui-state-highlight">Item 2</li>
  16. <li class="ui-state-highlight">Item 3</li>
  17. <li class="ui-state-highlight">Item 4</li>
  18. <li class="ui-state-highlight">Item 5</li>
  19. <li class="ui-state-highlight">Item 6</li>
  20. <li class="ui-state-highlight">Item 7</li>
  21. <li class="ui-state-highlight">Item 8</li>
  22. </ul>