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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:19:08+00:00 2026-05-16T07:19:08+00:00

How do we handle connect draggable items that should be connected to sortables when

  • 0

How do we handle connect draggable items that should be connected to sortables when the sortables are created at run time? For example:

<ul class='sortable'>
</ul>

I create instances of the above sortable ul when the user clicks a button:

function onBtnClick1() {
    var element = $("<ul class='sortable'></ul>");
    element.appendTo("#body");
    $(".sortable").sortable();  // make it sortable?
}

Later on the user can generate items to drag and drop into any of the sortables:

function onBtnClick2() {
    var element = $("<span>Hi there</span>");
    element.draggable();
    element.draggable("option", "connectToSortable", '.sortable');
}

it isn’t working though – I basically want to make the draggables above droppable into any ul that has the class type “sortable”. What’s the right way to do it?

Thanks

  • 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-05-16T07:19:08+00:00Added an answer on May 16, 2026 at 7:19 am

    you should set two more option to draggable to make it work

    element.draggable("option", "helper", 'clone');
    element.draggable("option", "revert", 'invalid');
    

    see documentation for connectToSortable and sortable draggable demo

    the complete function should look like this

    function onBtnClick2() {
        var element = $("<span>Hi there</span>");
        element.draggable({
            connectToSortable: '.sortable',
            helper: 'clone',
            revert: 'invalid',
            appendTo: '#container'
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given a handle of type HWND is it possible to confirm that the handle
I'm trying to handle Winsock_Connect event (Actually I need it in Excel macro) using
How to handle personal stress caused by utterly incompetent and lazy co-workers?
Is it possible to handle POSIX signals within the Java Virtual Machine? At least
Does your software handle newline characters from other systems? Linux/BSD linefeed ^J 10 x0A
I have the handle of process 'A' on a Pocket PC 2003 device. I
How does one handle a DateTime with a NOT NULL ? I want to
How does C handle converting between integers and characters? Say you've declared an integer
How do most people handle updating ASP.NET applications running in a webfarm? I am
I would like to handle an OracleException thrown when my network/database connection is interrupted,

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.