event

attaches an event handler to an HTML element

string event(HTMLElement|string node,string event,function handler, [object master] );
nodeHTMLElement|stringthe HTML node or its id
eventstringthe name of an HTML event (without the 'on' prefix)
handlerfunctionthe event handler
masterobjectan object that the this keyword refers to
stringthe event handler id (can be used by the eventRemove() method)

Example

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

Details

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

See also
Change log

added in version 4.4

Back to top