DHTMLX Docs & Samples Explorer

attachEvent(evName, evHandler)

Attaches a user-defined handler to any available event.

Parameters:

  • evName - the event name;
  • evHandler - a user-defined handler that will be called when event occurs.

    var myEvent = myCalendar.attachEvent("onClick", function(){
        // event handler code
    })

Returns eventId which then can be used to detach event.

Description:

  • several handlers can be attached to one and the same event, and all of them will be executed
  • event names are case-insensitive
  • if event handler can return value (usualy true or false, used in cancelable events like onBeforeChange) and several handlers are attached - result value will calculated as: value1 && value2 && …valueX

See also: