mySelection.on( eventName, eventHandler, capturePhase ) in D3.js

Retrieve the event listener for an event type.

Arguments

nametypedescription
eventName String Name of the event, e.g. ‘click’ or ‘mouseover’. To register multiple handlers for the same type on the same element, use a trailing namespace, e.g. ‘click.foo’ and ‘click.bar’.
eventHandler Function Function to be invoked when the event occurs. Will be passed the datum for the current object, the index of that object in the selection, and with the this context set to the DOM element. To remove an event handler, pass null for this parameter.
capturePhase Boolean Corresponds to the W3C useCapture flag.
Return Type
Selection

Description

For more details see https://github.com/mbostock/d3/wiki/Selections#wiki-on.

See Also