[jQuery] drag'n'drop, double added element
Hello. I'm trying to create drag'n'drop interface with jQuery UI.
See code for adding to node.
$("#dropzone").droppable({
accept: '.imagethumb',
activeClass: 'droppable-active',
hoverClass: 'droppable-hover',
drop: function(ev, ui) {
var id = $(ui.draggable.element).attr("id");
var src = $("#" + id).find("img")[0];
src = $(src).attr("src");
var el = $("<img/>").attr("id", id +
"d").attr("src",src).addClass("draggable").draggable({revert: true});
$("#dropzone").append(el);
}
});
If I drop element without FireBug checking and debugging,.I have two
element, (then 4, 6, 8, 10 and etc)
But if I create breakpoint and debug script only one element added.
Can't understand how it happens and what to do =(