Skip to main content

event

Description

Attaches an event handler to an HTML element

event: (node: HTMLElement|string, event: string, handler: SchedulerCallback, master?: any) => string

Parameters

  • node - (required) HTMLElement|string - the HTML node or its id
  • event - (required) string - the name of an HTML event (without the 'on' prefix)
  • handler - (required) function - the event handler
  • master - (optional) object - an object that the this keyword refers to

Returns

  • id - (string) - the 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.

Change log

  • added in version 4.4
Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.