sortable jquery

// use id
$( "#sortable" ).sortable();
$( "#sortable" ).disableSelection();


<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Sortable - Default functionality</title>
  <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <style>
  #sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
  #sortable li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; height: 18px; }
  #sortable li span { position: absolute; margin-left: -1.3em; }
  </style>
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
  $( function() {
    $( "#sortable" ).sortable();
    $( "#sortable" ).disableSelection();
  } );
  </script>
</head>
<body>
 
<ul id="sortable">
    <label> welcome  </label>
  <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 1</li>
  <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 2</li>
  <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 3</li>
  <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 4</li>
  <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 5</li>
  <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 6</li>
  <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 7</li>
</ul>
 
 
</body>
</html>

4.29
7
Wolf 90 points

                                    $('#element').sortable({
    axis: 'y',
    update: function (event, ui) {
        var data = $(this).sortable('serialize');

        // POST to server using $.post or $.ajax
        $.ajax({
            data: data,
            type: 'POST',
            url: '/your/url/here'
        });
    }
});

4.29 (7 Votes)
0
4
1
Peretz 90 points

                                    &lt;!doctype html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta charset=&quot;utf-8&quot;&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
  &lt;title&gt;jQuery UI Sortable - Default functionality&lt;/title&gt;
  &lt;link rel=&quot;stylesheet&quot; href=&quot;//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css&quot;&gt;
  &lt;link rel=&quot;stylesheet&quot; href=&quot;/resources/demos/style.css&quot;&gt;
  &lt;style&gt;
  #sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
  #sortable li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; height: 18px; }
  #sortable li span { position: absolute; margin-left: -1.3em; }
  &lt;/style&gt;
  &lt;script src=&quot;https://code.jquery.com/jquery-1.12.4.js&quot;&gt;&lt;/script&gt;
  &lt;script src=&quot;https://code.jquery.com/ui/1.12.1/jquery-ui.js&quot;&gt;&lt;/script&gt;
  &lt;script&gt;
  $( function() {
    $( &quot;#sortable&quot; ).sortable();
    $( &quot;#sortable&quot; ).disableSelection();
  } );
  &lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
 
&lt;ul id=&quot;sortable&quot;&gt;
  &lt;li class=&quot;ui-state-default&quot;&gt;&lt;span class=&quot;ui-icon ui-icon-arrowthick-2-n-s&quot;&gt;&lt;/span&gt;Item 1&lt;/li&gt;
  &lt;li class=&quot;ui-state-default&quot;&gt;&lt;span class=&quot;ui-icon ui-icon-arrowthick-2-n-s&quot;&gt;&lt;/span&gt;Item 2&lt;/li&gt;
  &lt;li class=&quot;ui-state-default&quot;&gt;&lt;span class=&quot;ui-icon ui-icon-arrowthick-2-n-s&quot;&gt;&lt;/span&gt;Item 3&lt;/li&gt;
  &lt;li class=&quot;ui-state-default&quot;&gt;&lt;span class=&quot;ui-icon ui-icon-arrowthick-2-n-s&quot;&gt;&lt;/span&gt;Item 4&lt;/li&gt;
  &lt;li class=&quot;ui-state-default&quot;&gt;&lt;span class=&quot;ui-icon ui-icon-arrowthick-2-n-s&quot;&gt;&lt;/span&gt;Item 5&lt;/li&gt;
  &lt;li class=&quot;ui-state-default&quot;&gt;&lt;span class=&quot;ui-icon ui-icon-arrowthick-2-n-s&quot;&gt;&lt;/span&gt;Item 6&lt;/li&gt;
  &lt;li class=&quot;ui-state-default&quot;&gt;&lt;span class=&quot;ui-icon ui-icon-arrowthick-2-n-s&quot;&gt;&lt;/span&gt;Item 7&lt;/li&gt;
&lt;/ul&gt;
 
 
&lt;/body&gt;
&lt;/html&gt;

4 (1 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
jquery sortable data jquery sortable table get order jquery sortable get elements sort in jquery how works save sort order of jquery sortable jquery sortable in ph[ sortable jquery conenctwith jquery sortable methods jquery sortable to array sortable with div jquery sortable inside sortable jquery sortable in jquery jquery sort define element sort list with jquery sortable sortable div jquery jquery sorteable jquery sortable js jquery sortable order manafer sortable tale jquery jquery sortable new element jquery sortable lists jquery sortable .sortable( &quot;anable&quot; ) jquery create element with sortable jquery sortable usage jquery.sortable.j jquery Sortable api jquery sort function sortable js jquery jquery sortable ul jquery sortable element order get order of sortable jquery jquery sortable() button sortable() jquery jquery sortable table jQuery sortable div jquery sortable box jquery sort order for element list sort function in jquery jquery sortable demo sort jquery jquery sortable handle jquery sortable example code sortable div in jquery sort results jquery sortablejs jquery order array in jquery sort desc jquery sortable js example example with jQuery SortableJS (jQuery,window,&quot;Sortable&quot;) sortable div jquery example sortable method in jquery how to sort a table html javascript jquery sort using jquery jquery sortable on html jquery.sortable jquery orderable sort order with jquery jquery sortable sortable jquery evento jquery .sortable jquery sortable docs jquery sortable options jquery sortable examples sortable jquery with find .sortable jquery sortable event jquery sortable jquery order arrange jquery sortable get order sortable function in jquery jquery sort items drag and drop sorting jquery ui multi level list group dragable jquery.sortable.js Sortable in js jquery sortable list library list drag and drop jquery sortable javascript order by jquery sort jquery draggable list reorder ui-sortable html jq Sortable on drop function javascript drag and drop sortable jquery sort library jquery ui on sort complete jq drag and drop elements to reorder callback function jq drag and drop elements to reorder how to sort element lists with jquery ui sortable sort list elements in jquery ui sortable sortable get order jquery order list jquery sortable putting in other jquery sortable array jquery ui sortable get sorted list ids only jquery ui sortable get sorted list sorting drang and drop ui-sortable-handle jquery jquery drag and rearrange div jquery sorting method example using jquery-ui sortable example using jquery sortable how to add droppable of in the sortable js movable list jquery ui draggable sortable cards sortable example jQuery drag and drop sorting jquery sortable example backend function sabe jquery sortable in db jquery sortable save order in database sortable-field-handler javscript jquery sortable how to get the order jquery draggable and sortable jquery sortable list html sortable list drag drop sorting jquery list with draggable option jquery #sortable jquery shortable jquery makesortable jquery sortable functions jquery sortable not accept drag and drop ordering jquery jquery sortable recieve jquery on sortable change jquery sortable specify items jquery sortable example jquery drag order list jquery draggable list jquery ui draggable list jquery ui sort list drag sortable events sortable jquery get order jquery drag and drop list css sortable click css sortable list jquery ui movable sortable jquery sortable jquery example multi dom element sortable in jquery ui order table jquery drag sort jquery sortable items sortable js jquery order list drag drop ui sortable jquery-sortable js example Sotrable example drag drop sort drag and drop jquery list jquery jquery ui order sort table jquery $.ui.sortable jquery ui drag and drop list jquery sortable drag and drop list jquery sortable download sortable in javascript jquery table sortable drag and drop jquery sortable ele.sortable() in jquery sortable order jquery
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source