Steve Gattuso Steve Gattuso - 1 year ago 89
Javascript Question

Move from sortable to sortable

Is there any way for me to allow a user to drag a div which I've put in a sortable list (

I used jquery ui's $.sortable()
function), into a different sortable list?

Answer Source

Check out the connectWith option for sortables.

Essentially, if you only want #DivA to be able to drag elements to #DivB your sortables would be:

$('#DivA').sortable({connectWith: ['#DivB']});

If you want to be able to exchange items between the two you have to set the relationship both ways:

$('#DivA').sortable({connectWith: ['#DivB']});
$('#DivB').sortable({connectWith: ['#DivA']});
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download