air
air

Reputation: 6264

jquery drag and drop clone

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...

Upvotes: 1

Views: 2397

Answers (1)

rahul
rahul

Reputation: 187110

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 )

Upvotes: 1

Related Questions