When using jQuery UI draggables and droppables, how do you change the dragged-and-dropped element on drop? I am trying to drag one DIV to another sortable DIV. On drop, I'd like to change the classes on the dropped DIV and change its innerHTML content.
After reading various StackOverflow questions, my code looks like this:
$(.column).droppable({
accept: '.element-dragging',
drop: function(event, ui) {
if ($(ui.draggable).hasClass(elemtxt)) {
$(ui.draggable).replaceWith('<div class=element element-txt>This text box has been added!</div>');
}
}
})
It's not working for me. :-(
A full copy of my code is located at http://www.marteki.com/jquery/bugkilling.php.