Test Case Boilerplate
Fork this way...
HTML
<script src="http://code.jquery.com/ui/jquery-ui-git.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/jquery-ui-git.css">
JavaScript
// utility method to create and select elements
$.fn.attach = function(html) {
return this.append(html).children(":last");
};
$('<ol class="selection" />').
attach("<li />").text("foo").end().
attach("<li />").text("bar").end().
attach("<li />").text("baz").end().
sortable(). // XXX: applied before element is part of the DOM
appendTo(document.body);
var options = {
connectToSortable: ".selection",
helper: "clone"
};
$('<ol />').
attach("<li />").text("alpha").draggable(options).end().
attach("<li />").text("bravo").draggable(options).end().
attach("<li />").text("charlie").draggable(options).end().
attach("<li />").text("delta").draggable(options).end().
appendTo(document.body);