Skip to main content

Home > @jsplumbtoolkit/browser-ui > Surface > on

Surface.on() method

Bind an event listener to the given DOM Element. This is a utility function that can be used on any element in the DOM, not just things rendered by the Toolkit.

Signature:

on(el: Document | Element | NodeListOf<Element>, event: string, callbackOrSelector: Function | string, callback?: Function): void;

Parameters

ParameterTypeDescription
elDocument | Element | NodeListOf<Element>Element, or elements, to bind the event listener to.
eventstringName of the event to bind to
callbackOrSelectorFunction | stringEither a callback, or if 4 args are given, this is a selector identifying some element(s) within the given element.
callbackFunctionEvent callback.

Returns:

void