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 has been in jsPlumb since the early days. 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 events on elements that are managed by the instance.

Signature:

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

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:

SourceSelector