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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 516k
  • Answers 516k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer For those interested in how I solved this. I just… May 16, 2026 at 6:55 pm
  • Editorial Team
    Editorial Team added an answer Your second suggestion seems more correct to me. I usually… May 16, 2026 at 6:55 pm
  • Editorial Team
    Editorial Team added an answer If you mean you want to eliminate the chipmunk effect,… May 16, 2026 at 6:55 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm currently using a thread to handle Connect and Send calls asynchronously. This is
I have a set of functions that handle the db connection. I want to
I have a user class that I need to use my database with. To
I'm trying to just make a simple asyncore example where one socket is the
I have code that looks like the following: //unrelated code snipped resolver.reset(new tcp::resolver(iosvc)); tcp::resolver::query
I'm trying to handle Winsock_Connect event (Actually I need it in Excel macro) using
I was wondering how to restrict an iPhone app only to run on an
I have a web form that collects information and submits it to a cgi
I have html file with php code in it. It contains code to connect
I'm implementing an application that will have a lot of clients querying lots of

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.