简体   繁体   中英

jQuery how to destroy draggable with clone()

$('div').draggable();
var x = $('#container').clone().find('div').draggable('destroy').end().html();
$('#save').val(x);

How do i destroy draggable() after we use clone. The html still contains the class .ui-draggable after destroying. Why is this happening and how can i work around it without having to to use removeClass() . destroy should handle this. Check http://jsfiddle.net/rzfPP/50/

Assigning .draggable() to the newly cloned divs and then immediately destroying those seems to do the trick:

$('div').draggable();
var x = $('#container').clone().find('div').draggable().draggable('destroy').end().html();
$('#save').val(x);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM