I have a “canvas” where I allow the user to add draggable boxes and connect them with jsPlumb. I want to let them delete one of those boxes at some point in time. To handle that, I first detach all connections and remove endpoints from the target element, which works fine
jsPlumb.detachAllConnections(targetBoxId);
jsPlumb.removeAllEndpoints(targetBoxId);
I then remove the actual DOM element:
$(targetEl).remove();
At this point, jsPlumb starts freaking out and doesn’t allow me to drag the remaning elements anymore:
I can keep resizing the boxes and making new connections, but dragging an element keeps failing and emitting the above error.
Is there something I’m doing wrong? In other words, is there a proper-er way to remove a jsPlumb element in a “draggable” environment?