Javascript 从div中删除所有jsPlumb端点
我正在尝试从一个div中删除所有jsPlumb端点,其中源端点在右侧,目标端点在左侧 以下是将端点添加到div的代码:Javascript 从div中删除所有jsPlumb端点,javascript,html,jsplumb,Javascript,Html,Jsplumb,我正在尝试从一个div中删除所有jsPlumb端点,其中源端点在右侧,目标端点在左侧 以下是将端点添加到div的代码: addEndpointsToDiv(“exp1”、“Right”、“Left”) 尝试#2 尝试#3 尝试#4 我在这篇帖子上找到了答案: 我只需要这一行代码: instance.removeAllEndpoints(divId) 下面是另一个不需要实例的示例: jsPlumb.removeAllEndpoints("divId"); 在此片段中: j
addEndpointsToDiv(“exp1”、“Right”、“Left”)
尝试#2
尝试#3
尝试#4
我在这篇帖子上找到了答案: 我只需要这一行代码:
instance.removeAllEndpoints(divId)
下面是另一个不需要实例的示例:
jsPlumb.removeAllEndpoints("divId");
在此片段中:
jsPlumb.removeAllEndpoints("divId")
实际发生的是,您正在对jsPlumb的“默认”实例调用该方法,该实例的存在是jsPlumb早期的遗留问题。对jsPlumb的“default”实例调用removeAllEndpoints
,对您创建的任何其他实例都没有影响
在4.x中,jsPlumb的这个“默认”实例不再存在
var endPoints = instance.selectEndpoints(divId)
endPoints.each(function (endpoint) {
instance.deleteEndpoint(endPoint)
});
var endpoints = instance.getendpoints(divid)
for (endpoint in endpoints)
instance.deleteendpoint(endpoint.endpoint)
instance.removeAllEndpoints(divId)
jsPlumb.removeAllEndpoints("divId");
jsPlumb.removeAllEndpoints("divId")