Clone a draggable div

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 …

via PHP Website Development » Search Results » ajax:

Clone a draggable div

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 ‘

‘;

// Make link draggable
echo “n”;Here is the HTML where the script is called.

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

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 “n”;

For more info: Clone a draggable div

PHP Website Development » Search Results » ajax

Clone a draggable div

Share this post:

Related Posts

Leave a Comment