javascript - How to re-append draggable element to droppable after empty -
I have a draggable / droppable script, where draggable is dropped, then the element in that device is droppable Once dropped, a clear button will show to remove the contents in the below given part
$ (e.target) .append (ui.draggable.html () + '
'); // $ (this) or (e.target) $ ("# add_friend"). Show (). FadeOut (12000); $ (E.target) .droppable ("deleted"); $ (E.target) .append ("& lt; input type = 'button' name = 'sub' value = 'clear' / & gt;"). Click (function () {$ (this) .empty ();}); The problem I am facing is that HTML is removed from the droppable divan, I can not drag again and can not be added again. . I want to be able to drag and drop elements after removing the content. I would appreciate to understand how to fix this problem and understand why this is so.
You want to delete the droppable but to disable it, you should do something like this: $ (e.target) .append (ui.draggable.html () + '
'); // $ (this) or (e.target) $ ("# add_friend"). Show (). FadeOut (12000); $ (E.target) .droppable ("disabled"); $ (E.target) .append ("& lt; input type = 'button' name = 'sub' value = 'clear' / & gt;"). Click (function () {$ (this) .empty () .droppable ("enabled");});
Comments
Post a Comment