Skip to main content

Home > @jsplumb/core > JsPlumbInstance > addSourceSelector

JsPlumbInstance.addSourceSelector() method#

Registers a selector for connection drag on the instance. This is a newer version of the makeSource functionality that had been in jsPlumb since the early days (and which, in 5.x, has been removed). With this approach, rather than calling makeSource on every element, you can register a CSS selector on the instance that identifies something that is common to your elements. This will only respond to mouse/touch events on elements that are managed by the instance.

Signature:

addSourceSelector(selector: string, params?: BehaviouralTypeDescriptor, exclude?: boolean): ConnectionDragSelector;

Parameters#

ParameterTypeDescription
selectorstringCSS3 selector identifying child element(s) of some managed element that should act as a connection source.
paramsBehaviouralTypeDescriptorOptions for the source: connector type, behaviour, etc.
excludebooleanIf true, the selector defines an 'exclusion': anything _except_ elements that match this.

Returns:

ConnectionDragSelector