I'm trying to implement a drag& drop feature using jQuery & it works great, now I want to replace the dragged element by another in the old place.
I'm using the clone()
method but since I'm new to jQuery, the code I wrote clones the element infinitely, can somebody help me?
This is my code:
<script>
$(function() {
$(".draggable").draggable(
{
drag : function(event, ui) {
$(this).clone().appendTo(this)
}
});
$(".droppable").droppable({
drop: function(event, ui) {
$(this).addClass("ui-state-highlight")
}
});
});
</script>