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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:02:40+00:00 2026-05-30T20:02:40+00:00

I have one sortable which contains tiles . In addition, I have a bunch

  • 0

I have one sortable which contains tiles. In addition, I have a bunch of droppables. I want the following interaction:

The user can drag tiles out of the sortable onto some droppable. Ideally, this would move the tile out of the sortable and append it to the droppable. In addition, the droppable should not accept anything anymore, i.e. there may be at most one tile on one droppable. I tried it in this fiddle http://jsfiddle.net/yXeMw/2/ but can’t get the “move” to work.

Once that works, the user should also be able to move the tile out of the droppable back to the sortable, which I tried out here: (removed link due to 2 links limit, was version 3 of that same fiddle.) but fails too. (I only tried with an alert as I think the “move from .. to ..” part should be the same.) See update 1.

I’ve been trying this for a few days and just can’t figure it out.

PS: I’ve read tons of similar questions here on SO, but none is really the same as my issue, i.e. moving the element from the sortable to the droppable.

Edit: I would welcome an alternative solution using Mootools aswell.

Update 1: The droppable -> sortable direction only didn’t work because my tiles inside the sortable had the float: left attribute which effectively made the sortable itself be of size 0px thus impossible to hover. Fixed fiddle: http://jsfiddle.net/yXeMw/5/

Update 2: Although I found a workaround (see my answer), I would still like to have a solution which moves the element. I couldn’t get any of appendTo or append to work.

  • 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-30T20:02:42+00:00Added an answer on May 30, 2026 at 8:02 pm

    So, I found out how to emulate it. I am not 100% satisfied with this solution because it doesn’t really move the element, so I will accept any better solution.

    Rather, I create a new element, remove the old one and hide the helper. Both clone and appendTo don’t seem to work.

    Here is the fiddle: http://jsfiddle.net/VyfkE/1/

    Aswell as the code in case the fiddle will get lost.

    html:

    <div class="slot">Drop one here</div>
    <div class="slot">Or one here</div>
    
    <div class="sortable">
        <div class="tile">item 1</div>
        <div class="tile">item 2</div>
        <div class="tile">item 3</div>
    </div>
    

    css:

    .slot {
        background-color: forestgreen;
        width:100px;
        height:100px;
        border: 1px solid black;
    }
    
    .sortable {
        display:table-row;
        background: #44F;
    }
    
    .tile {
        display:table-cell;
        background: firebrick;
        border: 1px solid black;
        width: 50px;
        height: 25px;
    }
    

    and finally the javascript:

    $(".slot").droppable({
        drop: function(ev, ui) {
            // Only want one tile per droppable!
            if ($(this).children().length === 0) {
                // Create the new element which will be inside the droppable.
                cl = $('<div>').addClass('tile').text(ui.draggable.text()).css({
                    background: 'cornflowerblue'
                });
                // Make it draggable back into the sortable.
                cl.draggable({
                    connectToSortable: '.sortable',
                    helper: 'clone' // <-- This is important!
                });
                $(this).append(cl);
    
                // And remove the element from the sortable.
                ui.helper.hide();
                ui.draggable.remove();
            }
        }
    });
    $(".sortable").sortable({
        connectWith: '.slot',
        revert: true,
        helper: 'clone', // <-- This is important, again!
        receive: function(ev, ui) {
            // If we get some item from a droppable, remove it from there.
            ui.item.remove();
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several sortable lists connected together, so I can drag one item from
I'm developing a plone4 site on which every user have a sortable inventory of
I have the following code which applies the jQuery UI Sortable plugin to all
I have an AjaxFallbackDefaultDataTable which contains one row per test result. A test result
I want to implement this view But I have one question: The text which
I have a sortable list like this one: http://jqueryui.com/demos/sortable Is it possible to get
I have one text input and one button (see below). How can I use
I have one std::list<> container and these threads: One writer thread which adds elements
I have one application which uses the standard .NET forms authentication cookie, now I
I have one user who gets an error message when he closes his browser.

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.