views:

530

answers:

3

i am using following code

var $albumcover = $('#albumcover');
<br>
$albumcover.droppable({
<br>
accept: '#trash2 li',
<br>
activeClass: 'ui-state-highlight',
drop: function(ev, ui) {
<br>
$(this).append($(ui.draggable).clone().attr('alt', 'nat'));
<br>
 $(this).find('img').css('width','100px');
<br>
$(this).find('img').css('height','100px');

}
});

how can i

add events to clone element when it's created so it should be drag able again...

+1  A: 

Replace

$(this).append($(ui.draggable).clone().attr('alt', 'nat'));

with

$(this).append($(ui.draggable).clone(true).attr('alt', 'nat'));

The true value is used to

Clone matched DOM Elements, and all their event handlers, and select the clones.

Read the doc

clone( bool )

rahul
A: 

i done this, but the problem is

when i try to drag new element old is dragged...

air
A: 

this is true. when an object cloned as clone(true) is dragged, the old element is dragged. can anyone please provide a solution to this? or how can i refer to the new element and write functions referring the new ones.

Vincy