jsplumb / community-edition

The community edition of jsPlumb, versions 1.x - 6.x
https://jsplumbtoolkit.com
Other
225 stars 18 forks source link

Make new connection when dragging an endpoint to an element? #278

Closed gejang closed 1 year ago

gejang commented 1 year ago

Is there a way to connect an endpoint of one element directly to another div? So far the examples I see can connect only from an endpoint of one div to another endpoint of another div.

If it's possible, could someone provide a quick code example?

sporritt commented 1 year ago

You can just connect an endpoint to an element:

jsPlumbInstance.connect({source:someEndpoint, target:someHTMLElement})

You will see an endpoint appear on target as a result of this, but you can use a Blank endpoint if you dont want to see it:

https://docs.jsplumbtoolkit.com/community/lib/endpoints#blank