Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 812623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:13:52+00:00 2026-05-15T01:13:52+00:00

I have 3 sortable UL’s and a simple jquery/javascript <ul class=sortable id=menu1> <li id=id_1>whatever</li>

  • 0

I have 3 sortable UL’s and a simple jquery/javascript

<ul class="sortable" id="menu1">
  <li id="id_1">whatever</li>
  <li id="id_2">you</li>
</ul>
<ul class="sortable" id="menu2">
  <li id="id_3">wanne</li>
  <li id="id_4">put</li>
</ul>
<ul class="sortable" id="menu3">
  <li id="id_5">in</li>
  <li id="id_6">here</li>
</ul>
$(function() {
    $("ul.sortable").sortable({
        connectWith: 'ul'
        });
    });
</script>

LI’s are draggable between UL’s
How can i serialize this so i get for example menu1[0]=1&menu1[1]=3
Or and array or whatever i can work with to save the state?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:13:52+00:00Added an answer on May 15, 2026 at 1:13 am

    UPDATED

    DEMO: http://jsbin.com/evoru4/2

    In your case use this:

    $(function() {
        $("ul.sortable").sortable({
            connectWith: '.sortable',
            update: function(event, ui) {
            var position = $('.sortable').serial();
            alert( position );
            }
        });
    });
    

    // this function make your UL LI a serialized object

    (function($) {
        $.fn.serial = function() {
            var array = [];
            var $elem = $(this);
            $elem.each(function(i) {
                var menu = this.id;
                $('li', this).each(function(e) {
                    array.push(menu + '[' + e + ']=' + this.id);
                });
            });
            return array.join('&');
        }
    })(jQuery);
    

    that give you something like this:

    menu1[0]=id_1&menu1[1]=id_2&menu2[0]=id_4&menu2[1]=id_6&menu3[0]=id_5&menu3[1]=id_3
    

    that is representing the position order of each element

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a sortable list (not jQuery UI sortable, just by a simple click
I'm trying to follow http://www.foliotek.com/devblog/make-table-rows-sortable-using-jquery-ui-sortable/ And have created a very simple example http://jsfiddle.net/6wbZQ/ It's
I have to implement jquery's sortable in my project. I am creating it dynamically.
I have multiple JQuery sortable lists that connect with each other... They allow you
I have a sortable list using JQueryUI and use the JQuery Each function to
here is a simple question. I have a 'ul' which i have made sortable
I have a sortable list of folders using JQuery UI. The thing is that
We have a sortable list using JQuery UI Sortable that we are trying to
I'm using jQuery 1.4 and jQuery UI sortable, my problem that i have two
first I have a sortable container with class=viewport , then I want show each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.