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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:27:03+00:00 2026-05-26T10:27:03+00:00

This script to clone a draggable has a weird effect. I create a clone

  • 0

This script to clone a draggable has a weird effect. I create a clone of a draggable div and then remove the original. When I drag the clone and drop it on a second container, two draggables appear: the original and the clone appended to the body. Neither is draggable after that. What could be the problem?

Here is the code where the element is created and made draggable. It is echoed from a php script when the page is loaded.

       // Add link with tools
       echo ' <div id="'.$url['ID'].'" class="link"> <img class="link_handle" src="http://www.google.com/s2/favicons?domain='.$urlico.'" align="middle" />&nbsp;<a href="'.$url->URL.'" target="_blank" onmouseOver="preview_link(\'show\', this, \''.$node['ID'].'\');" onmouseOut="preview_link(\'hide\', this, \''.$node['ID'].'\');" >'.$url->TITLE.'</a> <a title="Edit" class="link_button_edit" href="#" onClick=""></a><a title="Delete" class="link_button_delete" href="#" onClick="delete_link(\''.$url['ID'].'\', \''.$node['ID'].'\');"> </a> </div>';

       // Make link draggable
       echo "<script type='text/javascript'>\n";
       echo '  $("#'.$url['ID'].'.link").draggable({
                     handle: ".link_handle", 
                     helper: function() {  
                         $copy = $(this).clone();
                         $(this).remove();
                         return $copy; 
                     },
                     appendTo: "#page" ,
                     scroll: false,
                     revert: true,
                });';
       echo "</script>\n";

Here is the HTML where the script is called.

  <div id="page"> <!-- Begin page div -->

   <script type="text/javascript">

   $(document).ready(function() {

    // Make ajax call to recreate linkcards from XML data
    $.ajax({
         url: "get_nodes.php",
         type: "POST",
         data: { },
         cache: false,
         success: function (response) {
            if (response != '') 
            {
              $("#page").append(response);                 
              alert(response);
            }
         }
    });
   });
   </script>

  </div> <!-- End page div -->

I don’t have this accessible, it is only on my local pc.

  • 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-26T10:27:03+00:00Added an answer on May 26, 2026 at 10:27 am

    Found out that if I don’t remove the original the code works. Ideally, I’d prefer the behavior where the original is visually dragged from the first container to the second. This can only be done if the container does not have overflow: hidden. With cloning the original cannot be delete. This is not ideal but works. Here is the code that worked without the line $(this).remove();.

       // Make link draggable 
       echo "<script type='text/javascript'>\n"; 
       echo '  $("#'.$url['ID'].'.link").draggable({ 
                     handle: ".link_handle",  
                     helper: function() {   
                         $copy = $(this).clone(); 
                         return $copy;  
                     }, 
                     appendTo: "#page" , 
                     scroll: false, 
                     revert: true, 
                });'; 
       echo "</script>\n"; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code will only let me drag and drop ONE clone onto a
I have two li elements which are jQuery draggable. When I drag and drop
I'm trying to create a drag and drop function in my project that when
When I make a draggable clone and drop it in a droppable I cannot
how can I make this jquery script close all previously opened children when entering
I have a greasemonkey user script with this single line of code... window.close(); but
This is the file I'm using $.load() to load into DOM: <script type=text/javascript> $('.close').click(function()
For this script, it checks to see if the file is a microsoft words
I have this script: select name,create_date,modify_date from sys.procedures order by modify_date desc I can
I'm using this script to display all the images in a folder, but I

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.