event

attaches an event handler to an HTML element

void event(HTMLElement | string node,string event,function handler, [boolean | HandlerSettings options] );
nodeHTMLElement | stringthe HTML node or its id
eventstringthe name of an HTML event (without the 'on' prefix)
handlerfunctionthe event handler
optionsboolean | HandlerSettingsoptional, the value of either the useCapture or options parameter. Read details

Example

// adds a handler for the 'onclick' event
gantt.event("divId", "click", function(event){
    // e - DOM event object
    do_something();
}, options);

Details

All event listeners attached using event will be detached automatically when the destructor is called.

See also
Change log

added in version 4.0

Back to top