1
I’m trying to create a div
every time I drop one image on top of another div
, but the following is happening:
- At 1 time: creates 1 Div;
- In the 2nd time: creates 2 Div;
- In the 3rd time: creates 3 Div;
Is there any internal counter in the events ondragstart
and ondrop
?
<img ondragstart="dragStart(event)" class="icon" src="imagens/01.jpg" />
function dragStart(event) {
elem = event.target.getAttribute('id');
}
function drop(event) {
$('<div class="img"></div>').appendTo('#centro');
$('#'+elem).appendTo('.midia');
}
That didn’t work out. I entered after Alert(Event.isPropagationStopped()); to test if it is even by the propagation of events and it turned true with the continuation of the problem.
– Guilherme
The problem is the class name, media. Every time I send an image, it creates one in Div, but it also sends in the previous Div that has the same name. I will try to create a classless Div or change the class names every time an image is created.
– Guilherme