1// use id
2$( "#sortable" ).sortable();
3$( "#sortable" ).disableSelection();
4
5
6<html lang="en">
7<head>
8 <meta charset="utf-8">
9 <meta name="viewport" content="width=device-width, initial-scale=1">
10 <title>jQuery UI Sortable - Default functionality</title>
11 <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
12 <style>
13 #sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
14 #sortable li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; height: 18px; }
15 #sortable li span { position: absolute; margin-left: -1.3em; }
16 </style>
17 <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
18 <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
19 <script>
20 $( function() {
21 $( "#sortable" ).sortable();
22 $( "#sortable" ).disableSelection();
23 } );
24 </script>
25</head>
26<body>
27
28<ul id="sortable">
29 <label> welcome </label>
30 <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 1</li>
31 <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 2</li>
32 <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 3</li>
33 <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 4</li>
34 <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 5</li>
35 <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 6</li>
36 <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 7</li>
37</ul>
38
39
40</body>
41</html>
1<!doctype html>
2<html lang="en">
3<head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1">
6 <title>jQuery UI Sortable - Default functionality</title>
7 <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
8 <link rel="stylesheet" href="/resources/demos/style.css">
9 <style>
10 #sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
11 #sortable li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; height: 18px; }
12 #sortable li span { position: absolute; margin-left: -1.3em; }
13 </style>
14 <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
15 <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
16 <script>
17 $( function() {
18 $( "#sortable" ).sortable();
19 $( "#sortable" ).disableSelection();
20 } );
21 </script>
22</head>
23<body>
24
25<ul id="sortable">
26 <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 1</li>
27 <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 2</li>
28 <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 3</li>
29 <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 4</li>
30 <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 5</li>
31 <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 6</li>
32 <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 7</li>
33</ul>
34
35
36</body>
37</html>
38