jQuery: Trouble with draggable across cloned elements
Posted
by Rosarch
on Stack Overflow
See other posts from Stack Overflow
or by Rosarch
Published on 2010-05-13T17:12:04Z
Indexed on
2010/05/13
17:24 UTC
Read the original article
Hit count: 244
I'm trying to implement:
- User drags a draggable
li
to a droppableli
. - The original
li
is no longer draggable - A new
li
is cloned from the originalli
, and is appended to the droppableli
.
I can't get it to work.
function moveToTerm(original_course, helper, term) {
var cloned_course = original_course.clone(true);
original_course.addClass('already-scheduled');
original_course.draggable('disable');
cloned_course.draggable();
cloned_course.appendTo(term).hide().fadeIn('slow');
}
This works fine, except now the cloned_course is not draggable.
A droppable li
:
<li class="term ui-droppable">
<strong>Fall 2010</strong>
<li class="course">Computing Cultures</li>
<!-- this course was just dropped. I want it to be draggable but it's not -->
<li class="course ui-draggable" style="display: list-item;">New Media and Society</li>
</li>
What am I doing wrong?
© Stack Overflow or respective owner