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
Parameter | Type | Description |
---|---|---|
el | Document | Element | NodeListOf<Element> | Element, or elements, to bind the event listener to. |
event | string | Name of the event to bind to |
callbackOrSelector | Function | string | Either a callback, or if 4 args are given, this is a selector identifying some element(s) within the given element. |
callback | Function | Event callback. |
Returns:
void