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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:41:24+00:00 2026-06-11T19:41:24+00:00

I work with this example from jQuery UI Sortable I have a problem with

  • 0

I work with this example from jQuery UI Sortable

I have a problem with drag and drop.
Table number 3 – sortable3 should only be able to receive one item.

This is my HTML

<div class="demo">

<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'>
</ul>

My CSS

#sortable1, #sortable2, #sortable3{
    list-style-type: none; 
    margin: 0; 
    padding: 0; 
    float: left; 
    margin-right: 10px; 
    background: #eee; 
    padding: 5px; 
    width: 143px;
}

#sortable1 li, #sortable2 li, #sortable3 li{
    margin: 5px; 
    padding: 5px; 
    font-size: 1.2em; 
    width: 120px; 
}

My Script

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

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

    $("#sortable1, #sortable2, #sortable3").disableSelection();
});​
  • 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-11T19:41:25+00:00Added an answer on June 11, 2026 at 7:41 pm

    To prevent any additional items from being dropped into sortable3, cancel the drop if the maximum number has been exceeded.

    The code below is your current code, I only added the last method which attaches the received event to the third sortable.

    $(function() {
        $("ul.droptrue").sortable({
            connectWith: "ul",
        });
    
        $("ul.dropfalse").sortable({
            connectWith: "ul",
            dropOnEmpty: false
        });
    
        $("#sortable1, #sortable2, #sortable3").disableSelection();
    
        $("#sortable3").on("sortreceive", function(event, ui) {
            var $list = $(this);
    
            if ($list.children().length > 1) {
                $(ui.sender).sortable('cancel');
            }
        });
    });​
    

    DEMO​

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

Sidebar

Related Questions

I have used this example for a Jquery Live Dragable: jQuery Drag And Drop
Using this example: http://www.w3schools.com/php/php_ajax_database.asp I have set up a table echoing from database. I
I am getting to know boost::variant. I think this example should work. #include <boost/fusion/sequence.hpp>
I have a simple hide show jquery script I grabbed from an example site.
I have two pages - a simple HTML code example page from a jQuery
I copied this example from api.jquery.com $('.target').change(function() { alert('Handler for .change() called.'); }); I
Ok here is the problem. jQuery Resizable just does not work on this page:
i have this example found here: http://threedubmedia.com/code/event/drag/demo/resize2 and i tried to reproduce it in
I am having problems getting the TextWrapping to work in this example. Can anyone
I created this example The remove function doesn't work, and I can't figure out

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.