From the API Docs :
connectWith: Selector of other sortable elements to which elements from this list should be connected. This is a one-way relationship , if you want the elements to be connected in both directions, the connectWith option should be set on both elements to be sorted .
The sample code you gave seems to be similar to the jQuery UI demo site below. If you study the code, you will notice that the CSS class .connectedSortable
declared in both lists:
<ul id="sortable1" class="connectedSortable"> <li class="ui-state-default">Item 1</li> ... </ul> <ul id="sortable2" class="connectedSortable"> <li class="ui-state-highlight">Item 1</li> ... </ul>
The code you provide will make this sortable list bidirectional. To do this unilaterally, you can specify a different selector:
$(function() { $( "#sortable1, #sortable2" ).sortable({ connectWith: "#sortable2"
See jsFiddle for example
source share