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 8131459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:05:44+00:00 2026-06-06T09:05:44+00:00

I have two pairs of drag/drop/sortable lists using JqueryUI.http://jqueryui.com/demos/sortable/ My problem is that I

  • 0

I have two pairs of drag/drop/sortable lists using JqueryUI.http://jqueryui.com/demos/sortable/

My problem is that I can move items from sortable1, sortable2 into sortable3 and 4. I want them to be debated. So items can only move between ( 1 and 2 ) and (3 and 4).

Do I have to assign a different class to sortable3 and sortable4 for this to happen? Is there anyway I can somehow combine the function?

$(function() {
        $( "ul.droptrue" ).sortable({
            connectWith: "ul"
        });

        $( "ul.dropfalse" ).sortable({
            connectWith: "ul",
            dropOnEmpty: false
        });

        $( "#sortable1, #sortable2" ).disableSelection();
        $( "#sortable3, #sortable4").disableSelection();

});


<ul id="sortable1" class='droptrue'>
    <li class="ui-state-default">Can be dropped..</li>
    <li class="ui-state-default">..on an empty list</li>
    <li class="ui-state-default">Item 3</li>
    <li class="ui-state-default">Item 4</li>
    <li class="ui-state-default">Item 5</li>
</ul>

<ul id="sortable2" class='dropfalse'>
    <li class="ui-state-highlight">Cannot be dropped..</li>
    <li class="ui-state-highlight">..on an empty list</li>
    <li class="ui-state-highlight">Item 3</li>
    <li class="ui-state-highlight">Item 4</li>
    <li class="ui-state-highlight">Item 5</li>
</ul>
<ul id="sortable3" class='droptrue'>
    <li class="ui-state-default">Can be dropped..</li>
    <li class="ui-state-default">..on an empty list</li>
    <li class="ui-state-default">Item 3</li>
    <li class="ui-state-default">Item 4</li>
    <li class="ui-state-default">Item 5</li>
</ul>

<ul id="sortable4" class='dropfalse'>
    <li class="ui-state-highlight">Cannot be dropped..</li>
    <li class="ui-state-highlight">..on an empty list</li>
    <li class="ui-state-highlight">Item 3</li>
    <li class="ui-state-highlight">Item 4</li>
    <li class="ui-state-highlight">Item 5</li>
</ul>
  • 1 1 Answer
  • 0 Views
  • 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-06-06T09:05:45+00:00Added an answer on June 6, 2026 at 9:05 am

    Because of your droptrue and dropfalse parameters, and the fact that you have unique id’s on each list, you don’t need to change the markup, you just need to call the .sortable function a bit differently:

        $( "#sortable1" ).sortable({
            connectWith: "#sortable2"
        });
    
        $( "#sortable2" ).sortable({
            connectWith: "#sortable1",
            dropOnEmpty: false
        });
    
        $( "#sortable3" ).sortable({
            connectWith: "#sortable4",
        });
    
        $( "#sortable4" ).sortable({
            connectWith: "#sortable3",
            dropOnEmpty: false
        });
    

    Alternatively, you could use an object to set up the parameters of each sortable item, and iterate through the object, using the parameters to apply .sortable to each:

    var lists = [{"listid":"#sortable1", "connectid":"#sortable2", "drop":true},
     {"listid":"#sortable2", "connectid":"#sortable1", "drop":false},
     {"listid":"#sortable3", "connectid":"#sortable4", "drop":true},
     {"listid":"#sortable4", "connectid":"#sortable3", "drop":false}];
    
    $.each(lists, function(i, list) {
        $(list.listid).sortable({
            connectWith: list.connectid,
            dropOnEmpty: list.drop
        });
    });
    

    EDIT:
    Based on your comment, this is how you could tie in yet another list (#sortable5, connecting to both #sortable3 and #sortable4). Note the use of multiple id’s, separated by commas:

    var lists = [{"listid":"#sortable1", "connectid":"#sortable2", "drop":true},
     {"listid":"#sortable2", "connectid":"#sortable1", "drop":false},
     {"listid":"#sortable3", "connectid":"#sortable4, #sortable5", "drop":true},
     {"listid":"#sortable4", "connectid":"#sortable3, #sortable5", "drop":false},
     {"listid":"#sortable5", "connectid":"#sortable3, #sortable4", "drop":false}];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem, let's say: Find all two pairs of numbers (x,y) and
I have two files client.php and server.php. The client file send a HTTP request
I have two columns say Main and Sub . (they can be of same
Let's say I have two pairs of SQL conditions like these: a = [
In R, I have two vectors of pairs like this: x <- c(A=5, B=1,
I have two iterables, and I want to go over them in pairs: foo
let's say I have two lists: a = list(1,2,3) b = list(4,5,6) So I
I have two dictionaries with key-value pairs as follows: dict-1 ch:23, 100 ch:24, 95
Can someone suggest that out of the two mentioned (odd?) combinations, which is less
I have two tables, the first puts puts pairs of people into a group

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.