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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:22:41+00:00 2026-06-03T17:22:41+00:00

I have some jquery code that i want to able to drag, drop, clone

  • 0

I have some jquery code that i want to able to drag, drop, clone and resize. I can drag and drop and resize at the first attempt. After which i drag the cloned item around the container, it is not able to resize anymore. Any idea why?

my HTML,css and jquery from dragndrop.js as below

.col{
    float:left;
    padding: 5px 5px 5px 5px;
    margin: 5px 5px 5px 5px;
}

#col1{
    width:200px;
    height:500px;
    border:1px solid black;

}

.drag{
    width:100px;
    border:1px solid black;
    height:40px;
    position:relative;
    background-color:red;
}

#droppable{
    width:500px;
    height :500px;
    border:1px solid black;
    }

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="dragndrop.css" />
        <script src="http://www.google.com/jsapi" type="text/javascript"></script>
        <script type="text/javascript">
           google.load("jquery", "1.6.3");
           google.load("jqueryui", "1.8.16");
        </script>
        <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css"/>
        <script src="dragndrop.js" type="text/javascript"></script>
    </head>
    <body>
        <div id="wrapper">
            <div class = "col" id="col1">
                <div id="drag1" class="drag">
                </div>
            </div>
            <div class="col" id ="droppable">
            </div>
        </div>
    </body>
</html>

$(document).ready(function () {

    var x = null;

    //Make element draggable
    $(".drag").draggable({
        helper: 'clone',
        cursor: 'move',
        tolerance: 'fit'
    });

    $("#droppable").droppable({

        drop: function(e, ui) {

            x = ui.helper.clone();
                  x.draggable({
                helper: 'original',
                containment: '#droppable',
                tolerance: 'fit'
            });
            x.resizable({
                maxHeight: 40,
                minHeight:40,
                minWidth:50
            });
            x.appendTo('#droppable');
            ui.helper.remove();
        }
    });

});
  • 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-03T17:22:43+00:00Added an answer on June 3, 2026 at 5:22 pm

    The problem was that you were cloning the div that was already on the droppable surface.

    I added check (may need to be updated) to see if the id was set (when they were cloned the id was set to “”) and if it was blank then clone and add to droppable surface, otherwise, leave it alone, it’s already droppable.

            $("#droppable").droppable({
    
                drop: function (e, ui) {
    
                    if ($(ui.draggable)[0].id != "") {
                        x = ui.helper.clone();
                    ui.helper.remove();
                    x.draggable({
                        helper: 'original',
                        containment: '#droppable',
                        tolerance: 'fit'
                    });
                    x.resizable({
                        maxHeight: 40,
                        minHeight: 40,
                        minWidth: 50
                    });
                    x.appendTo('#droppable');
                }
    
                }
            });
    

    See full demonstration here http://jsfiddle.net/ezzxX/2/

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

Sidebar

Related Questions

I have some jquery code that is doing an ajax lookup and returning comma
I have some jQuery code that highlights a link when clicked, and changes the
I have some jQuery code that intercepts links clicked on a page: $(document).ready(function() {
I have some jQuery code that is having difficulty running because I'm using it
I have some jQuery code that runs fine until I add the jQuery UI
I have the following block of jQuery code that I'm using to copy some
Trying to get comfortable with jQuery and I have encountered some sample code that
I have a jquery line of code that outputs some HTML to a div.
I have some jquery code which I am trying to translate to YUI. I
I have some jQuery code: $(function(){ function someFunc(){ /*do something*/ }; ............. }); And

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.