1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
---|
2 | <html lang="en"> |
---|
3 | |
---|
4 | <head> |
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
---|
6 | <title>Test Case</title> |
---|
7 | </head> |
---|
8 | |
---|
9 | <body> |
---|
10 | <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script> |
---|
11 | <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js" type="text/javascript"></script> |
---|
12 | <script type="text/javascript"> |
---|
13 | $(function() { |
---|
14 | |
---|
15 | // utility method to create and select elements |
---|
16 | $.fn.attach = function(html) { |
---|
17 | return this.append(html).children(":last"); |
---|
18 | }; |
---|
19 | |
---|
20 | $('<ol class="selection" />'). |
---|
21 | attach("<li />").text("foo").end(). |
---|
22 | attach("<li />").text("bar").end(). |
---|
23 | attach("<li />").text("baz").end(). |
---|
24 | sortable(). // XXX: applied before element is part of the DOM |
---|
25 | appendTo(document.body); |
---|
26 | |
---|
27 | var options = { |
---|
28 | connectToSortable: ".selection", |
---|
29 | helper: "clone" |
---|
30 | }; |
---|
31 | $('<ol />'). |
---|
32 | attach("<li />").text("alpha").draggable(options).end(). |
---|
33 | attach("<li />").text("bravo").draggable(options).end(). |
---|
34 | attach("<li />").text("charlie").draggable(options).end(). |
---|
35 | attach("<li />").text("delta").draggable(options).end(). |
---|
36 | appendTo(document.body); |
---|
37 | |
---|
38 | }); |
---|
39 | </script> |
---|
40 | </body> |
---|
41 | |
---|
42 | </html> |
---|