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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:51:17+00:00 2026-06-14T13:51:17+00:00

I am using jQuery’s draggable and droppable in order to drop content elements onto

  • 0

I am using jQuery’s draggable and droppable in order to drop content elements onto a page element:

<h2>Page</h2>

<div id='page-content'>

</div>

<div id='content-elements'>
  <div id='text-element' class='content-element'>Text</div>
  <div id='date-element' class='content-element'>Date</div>
</div>​

My JS for the draggable looks like this:

$elements.draggable({
  revert: true
});

The reason I have that revert in there is that I want the content element to return to the list of elements and a ‘duplicate’ to be added to the page.

I tried doing this using this js for the droppable (created using coffeescript):

$('#page-content').droppable({
  drop: function(event, ui) {
    var $element, $me;
    $me = $(this);
    $element = $(ui.draggable);
    console.log($element.clone(false));
    return $element.clone().appendTo($me);
  }
});

What this does is get the ui element that was dragged, attempt to clone it and then append it to the page.

This however does not work! Even though I CAN get the div, etc from the ui.draggable.

I created a jsfiddle to illustrate the problem:
http://jsfiddle.net/sw4Gc/2/

Why oh why?

  • 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-14T13:51:18+00:00Added an answer on June 14, 2026 at 1:51 pm

    The element was cloned in a state where it is in position relative and is outside the element. you have to remove the element styles:

    var $newElement = $element.clone();
    $newElement.attr('style', '');
    $newElement.appendTo($me);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using JQuery, how do I select all elements with class x within an element
Using jQuery Nearest Element , I would like to select elements in a circular
Using jQuery the child elements of the #parent element are to be fetched with
Using jQuery I'm programmatically generating a bunch of div 's like this: <div class=mydivclass
Using jquery how do I focus the first element (edit field, text area, dropdown
Using jquery, how can I change the color of these elements to red if
Using jQuery, how can I get the input element that has the caret's (cursor's)
Using jquery, how can I find the first div that contains an input with
Using jQuery, I want to check if the text of a link I'm clicking
Using jquery's .css() i am changing the left attributes value to move a div

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.