Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/414.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从div中删除所有jsPlumb端点_Javascript_Html_Jsplumb - Fatal编程技术网

Javascript 从div中删除所有jsPlumb端点

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

我正在尝试从一个div中删除所有jsPlumb端点,其中源端点在右侧,目标端点在左侧

以下是将端点添加到div的代码:

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")